pub trait Weight: Data {
// Required methods
fn set_zero(&mut self);
fn is_zero(&self) -> bool;
unsafe fn raw_add(&self, rhs: *const u8, result: *mut u8);
unsafe fn raw_add_assign(&mut self, rhs: *const u8);
}Expand description
A trait for types that can be used as weights in DBSP.
Such types must implement the plus operation and have a neutral element wrt addition (zero).
Required Methods§
Sourceunsafe fn raw_add(&self, rhs: *const u8, result: *mut u8)
unsafe fn raw_add(&self, rhs: *const u8, result: *mut u8)
Add the value of rhs to self, store the result in result.
§Safety
rhs and result must be valid pointers to values of type Self.
Sourceunsafe fn raw_add_assign(&mut self, rhs: *const u8)
unsafe fn raw_add_assign(&mut self, rhs: *const u8)
Add the value of rhs to self, store the result in self.
§Safety
rhs must be a valid pointer to a value of type Self
Blanket Implementations§
Source§impl<V> Erase<dyn Weight> for V
impl<V> Erase<dyn Weight> for V
Source§fn erase(&self) -> &(dyn Weight + 'static)
fn erase(&self) -> &(dyn Weight + 'static)
Convert a reference to
self into a reference to Trait.Source§fn erase_mut(&mut self) -> &mut (dyn Weight + 'static)
fn erase_mut(&mut self) -> &mut (dyn Weight + 'static)
Convert a mutable reference to
self into a mutable reference to Trait.Source§fn erase_archived(
archived: &<V as Archive>::Archived,
) -> &<dyn Weight as ArchiveTrait>::Archived
fn erase_archived( archived: &<V as Archive>::Archived, ) -> &<dyn Weight as ArchiveTrait>::Archived
Convert a reference to an archived representation of
Self into a reference
to a trait object of type Trait::Archived.