pub struct P2PSessionBuilder<T>where
T: Config,{ /* private fields */ }Expand description
A builder for P2PSession.
Implementations§
Source§impl<T> P2PSessionBuilder<T>where
T: Config,
impl<T> P2PSessionBuilder<T>where
T: Config,
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new builder. Identical to P2PSession::build.
Sourcepub fn with_frame_delay(self, frame_delay: i32) -> Self
pub fn with_frame_delay(self, frame_delay: i32) -> Self
Sets how much frame delay is used for all active players. Defaults to 3 frames.
Sourcepub fn with_disconnect_timeout(self, timeout: Duration) -> Self
pub fn with_disconnect_timeout(self, timeout: Duration) -> Self
Sets how long the client will wait for a packet from a remote player before considering the connection disconnected. Defaults to 5000ms.
Sourcepub fn with_disconnect_notify_start(self, timeout: Duration) -> Self
pub fn with_disconnect_notify_start(self, timeout: Duration) -> Self
Sets how long the client will wait for a packet from a remote player before before firing a Event::ConnectionInterrupted event. Defaults to 750ms.
Sourcepub fn add_player(&mut self, player: Player) -> PlayerHandle
pub fn add_player(&mut self, player: Player) -> PlayerHandle
Adds a player to the session and returns the corresponding handle.
Sourcepub fn start(self) -> BackrollResult<P2PSession<T>>
pub fn start(self) -> BackrollResult<P2PSession<T>>
Constructs and starts the P2PSession. Consumes the builder.
§Errors
Returns BackrollError::MultipleLocalPlayers if there are multiple local players. Backroll currently only supports one local player.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for P2PSessionBuilder<T>
impl<T> RefUnwindSafe for P2PSessionBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for P2PSessionBuilder<T>where
T: Send,
impl<T> Sync for P2PSessionBuilder<T>where
T: Sync,
impl<T> Unpin for P2PSessionBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for P2PSessionBuilder<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more