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§
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<()>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".