Struct renetcode::ConnectToken
source · pub struct ConnectToken { /* private fields */ }
Expand description
A public connect token that the client receives to start connecting to the server. How the client receives ConnectToken is up to you, could be from a matchmaking system or from a call to a REST API as an example.
Implementations
sourceimpl ConnectToken
impl ConnectToken
sourcepub fn generate(
current_time: Duration,
protocol_id: u64,
expire_seconds: u64,
client_id: u64,
timeout_seconds: i32,
server_addresses: Vec<SocketAddr>,
user_data: Option<&[u8; 256]>,
private_key: &[u8; 32]
) -> Result<Self, TokenGenerationError>
pub fn generate(
current_time: Duration,
protocol_id: u64,
expire_seconds: u64,
client_id: u64,
timeout_seconds: i32,
server_addresses: Vec<SocketAddr>,
user_data: Option<&[u8; 256]>,
private_key: &[u8; 32]
) -> Result<Self, TokenGenerationError>
Generate a token to be sent to an client. The user data is available to the server after an successfull conection. The private key and the protocol id must be the same used in server.
pub fn write(&self, writer: &mut impl Write) -> Result<(), Error>
pub fn read(src: &mut impl Read) -> Result<Self, NetcodeError>
Trait Implementations
sourceimpl Clone for ConnectToken
impl Clone for ConnectToken
sourcefn clone(&self) -> ConnectToken
fn clone(&self) -> ConnectToken
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for ConnectToken
impl Debug for ConnectToken
sourceimpl PartialEq<ConnectToken> for ConnectToken
impl PartialEq<ConnectToken> for ConnectToken
sourcefn eq(&self, other: &ConnectToken) -> bool
fn eq(&self, other: &ConnectToken) -> bool
impl Eq for ConnectToken
impl StructuralEq for ConnectToken
impl StructuralPartialEq for ConnectToken
Auto Trait Implementations
impl RefUnwindSafe for ConnectToken
impl Send for ConnectToken
impl Sync for ConnectToken
impl Unpin for ConnectToken
impl UnwindSafe for ConnectToken
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more