Skip to main content

Policy

Trait Policy 

Source
pub trait Policy: 'static {
    type Id: Copy + Eq;
    type Lease: Copy;

    // Required methods
    fn id(lease: Self::Lease) -> Self::Id;
    fn checkout(
        &mut self,
        token: u64,
        now: Instant,
        deadline: Instant,
    ) -> Result<()>;
    fn cancel(&mut self, token: u64, now: Instant);
    fn connected(&mut self, id: Self::Id, now: Instant) -> Result<()>;
    fn connect_failed(&mut self, id: Self::Id, now: Instant) -> Result<()>;
    fn checkin(
        &mut self,
        lease: Self::Lease,
        now: Instant,
        destroy: bool,
    ) -> Result<()>;
    fn closed(&mut self, id: Self::Id, now: Instant) -> Result<()>;
    fn event(&mut self) -> Option<Action<Self::Id, Self::Lease>>;
    fn next_deadline(&self) -> Option<Instant>;
    fn expire(&mut self, now: Instant);
    fn end(&mut self) -> Result<()>;
}

Required Associated Types§

Required Methods§

Source

fn id(lease: Self::Lease) -> Self::Id

Source

fn checkout( &mut self, token: u64, now: Instant, deadline: Instant, ) -> Result<()>

Source

fn cancel(&mut self, token: u64, now: Instant)

Source

fn connected(&mut self, id: Self::Id, now: Instant) -> Result<()>

Source

fn connect_failed(&mut self, id: Self::Id, now: Instant) -> Result<()>

Source

fn checkin( &mut self, lease: Self::Lease, now: Instant, destroy: bool, ) -> Result<()>

Source

fn closed(&mut self, id: Self::Id, now: Instant) -> Result<()>

Source

fn event(&mut self) -> Option<Action<Self::Id, Self::Lease>>

Source

fn next_deadline(&self) -> Option<Instant>

Source

fn expire(&mut self, now: Instant)

Source

fn end(&mut self) -> Result<()>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§