Struct backroll::P2PSessionBuilder
source · [−]pub struct P2PSessionBuilder<T> where
T: Config, { /* private fields */ }Expand description
A builder for P2PSession.
Implementations
sourceimpl<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, pool: TaskPool) -> BackrollResult<P2PSession<T>>
pub fn start(self, pool: TaskPool) -> 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> 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more