pub struct Contract { /* private fields */ }Expand description
The consumption contract: which regions must be reached, and what fraction of them (permille) satisfies the author.
Implementations§
Source§impl Contract
impl Contract
Sourcepub fn new(
regions: Vec<Region>,
min_permille: u16,
) -> Result<Self, ContractError>
pub fn new( regions: Vec<Region>, min_permille: u16, ) -> Result<Self, ContractError>
Validate a whole contract.
Sourcepub fn regions(&self) -> &[Region]
pub fn regions(&self) -> &[Region]
The declared regions, in declaration order (bit i of a touch
mask names regions()[i]).
Sourcepub fn min_permille(&self) -> u16
pub fn min_permille(&self) -> u16
The satisfaction threshold, as a permille of declared regions.
Sourcepub fn touched_by_span(&self, from: u32, to: u32) -> u8
pub fn touched_by_span(&self, from: u32, to: u32) -> u8
Which regions a served line window [from, to] touches, as the
event bitmask.
Sourcepub fn touched_by_line(&self, line: u32) -> u8
pub fn touched_by_line(&self, line: u32) -> u8
Which regions a single served line touches (search hits).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Contract
impl<'de> Deserialize<'de> for Contract
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Contract
impl StructuralPartialEq for Contract
Auto Trait Implementations§
impl Freeze for Contract
impl RefUnwindSafe for Contract
impl Send for Contract
impl Sync for Contract
impl Unpin for Contract
impl UnsafeUnpin for Contract
impl UnwindSafe for Contract
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