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