FuriEncoder

Struct FuriEncoder 

Source
pub struct FuriEncoder<'a> { /* private fields */ }
Expand description

An encoder fur furigana.

Implementations§

Source§

impl<'a> FuriEncoder<'a>

Source

pub fn new(out: &'a mut String) -> Self

Create a new furigana encoder with a buf as output.

Source

pub fn write_seg<S: AsSegment>(&mut self, segment: S)

Encodes a segment

Source

pub fn write_kana(&mut self, kana: &str)

Writes kana to the buffer.

Source

pub fn write_block(&mut self, kanji: &str, kana: &str)

Writes a single block of [kanji|kana] to the buffer.

Source

pub fn write_reading<R: AsReadingRef>(&mut self, r: R)

Writes a [jp_utils::reading::Reading] into the furi encoder.

Note that readings can contain kana characters in their kanji strings.

Source

pub fn write_kanji<K: AsKanjiSegment>(&mut self, k: K)

Writes a kanji segment

Trait Implementations§

Source§

impl<'a, S> Extend<S> for FuriEncoder<'a>
where S: AsSegment,

Source§

fn extend<T: IntoIterator<Item = S>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for FuriEncoder<'a>

§

impl<'a> RefUnwindSafe for FuriEncoder<'a>

§

impl<'a> Send for FuriEncoder<'a>

§

impl<'a> Sync for FuriEncoder<'a>

§

impl<'a> Unpin for FuriEncoder<'a>

§

impl<'a> !UnwindSafe for FuriEncoder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.