Skip to content

Commit

Permalink
Add PhantomData's marker in Api to prevent us from bypassing Api::new()
Browse files Browse the repository at this point in the history
  • Loading branch information
masa-koz committed Dec 18, 2024
1 parent c8f610c commit f6ce6f8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use libc::c_void;
use serde::{Deserialize, Serialize};
use std::convert::TryInto;
use std::fmt;
use std::marker::PhantomData;
use std::option::Option;
use std::ptr;
use std::result::Result;
Expand Down Expand Up @@ -1245,7 +1246,9 @@ static mut APITABLE: *const ApiTable = ptr::null();
static START_MSQUIC: Once = Once::new();

/// Entry point for some global MsQuic APIs.
pub struct Api;
pub struct Api {
marker: PhantomData<()>,
}

/// The execution context for processing connections on the application's behalf.
pub struct Registration {
Expand Down Expand Up @@ -1401,7 +1404,7 @@ impl Api {
APITABLE = table;
});
}
Self
Self { marker: PhantomData }
}

pub fn close_listener(&self, listener: Handle) {
Expand Down

0 comments on commit f6ce6f8

Please sign in to comment.