pub struct ConnectionMatrix<'a> { /* private fields */ }
Implementations§
source§impl<'a> ConnectionMatrix<'a>
impl<'a> ConnectionMatrix<'a>
pub fn from_offset_size( data: &'a [u8], offset: usize, num_left: usize, num_right: usize, ) -> SudachiResult<ConnectionMatrix<'a>>
sourcepub fn cost(&self, left: u16, right: u16) -> i16
pub fn cost(&self, left: u16, right: u16) -> i16
Gets the value of the connection matrix
It is performance critical that this function
- Has no branches
- Is inlined to the caller
This is UB if index is out of bounds, but that can’t happen except in the case if the binary dictionary was tampered with. It is OK to make usage of tampered binary dictionaries UB.
pub fn update(&mut self, left: u16, right: u16, value: i16)
Auto Trait Implementations§
impl<'a> Freeze for ConnectionMatrix<'a>
impl<'a> RefUnwindSafe for ConnectionMatrix<'a>
impl<'a> Send for ConnectionMatrix<'a>
impl<'a> Sync for ConnectionMatrix<'a>
impl<'a> Unpin for ConnectionMatrix<'a>
impl<'a> UnwindSafe for ConnectionMatrix<'a>
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more