pub struct Connection { /* private fields */ }Expand description
High-performance connection state machine.
Optimized for minimal branching and cache efficiency.
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn state(&self) -> ConnectionState
pub fn state(&self) -> ConnectionState
Get current state.
Sourcepub fn request_count(&self) -> u32
pub fn request_count(&self) -> u32
Get request count.
Sourcepub fn keep_alive(&self) -> bool
pub fn keep_alive(&self) -> bool
Check if keep-alive is enabled.
Sourcepub fn set_keep_alive(&mut self, enabled: bool)
pub fn set_keep_alive(&mut self, enabled: bool)
Set keep-alive.
Sourcepub fn handle_event(&mut self, event: ConnectionEvent) -> TransitionAction
pub fn handle_event(&mut self, event: ConnectionEvent) -> TransitionAction
Handle an event with branchless state transition.
Returns the action to perform.
Sourcepub fn try_transition(
&mut self,
event: ConnectionEvent,
) -> Result<TransitionAction, TransitionError>
pub fn try_transition( &mut self, event: ConnectionEvent, ) -> Result<TransitionAction, TransitionError>
Try transition with validation.
Returns Ok(action) if transition is valid, Err otherwise.
Sourcepub fn force_close(&mut self)
pub fn force_close(&mut self)
Force close the connection.
Sourcepub fn should_close(&self, idle_timeout: Duration) -> bool
pub fn should_close(&self, idle_timeout: Duration) -> bool
Check if connection should be closed (idle timeout).
Trait Implementations§
Source§impl Debug for Connection
impl Debug for Connection
Auto Trait Implementations§
impl Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnwindSafe for Connection
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
Source§impl<T> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging