[−][src]Struct pyphen_rs::Pyphen
Hyphenation class, with methods to hyphenate strings in various ways.
Methods
impl Pyphen
[src]
pub fn positions(&self, word: &str) -> Vec<DataInt>
[src]
Get a list of positions where the word can be hyphenated. The points that are too far to the left or right are removed.
- word - unicode string of the word to hyphenate
ⓘImportant traits for Iter<'a>pub fn iterate<'b>(&self, word: &'b str) -> Iter<'b>
[src]
Iterate over all hyphenation possibilities, the longest first.
- word - unicode string of the word to hyphenate
pub fn wrap_with<'b>(
&self,
word: &'b str,
width: usize,
hyphen: &str
) -> Option<(String, Cow<'b, str>)>
[src]
&self,
word: &'b str,
width: usize,
hyphen: &str
) -> Option<(String, Cow<'b, str>)>
Get the longest possible first part and the last part of a word.
The first part has the hyphen already attached.
Returns None
if there is no hyphenation point before width
, or
if the word could not be hyphenated.
- word - unicode string of the word to hyphenate
- width - maximum length of the first part
- hyphen - unicode string used as hyphen character
pub fn wrap<'b>(
&self,
word: &'b str,
width: usize
) -> Option<(String, Cow<'b, str>)>
[src]
&self,
word: &'b str,
width: usize
) -> Option<(String, Cow<'b, str>)>
Get the longest possible first part and the last part of a word.
The first part has the hyphen already attached.
Returns None
if there is no hyphenation point before width
, or
if the word could not be hyphenated.
- word - unicode string of the word to hyphenate
- width - maximum length of the first part
pub fn inserted_with(&self, word: &str, hyphen: &str) -> String
[src]
Get the word as a string with all the possible hyphens inserted.
- word - unicode string of the word to hyphenate
- hyphen - unicode string used as hyphen character
Example
use pyphen_rs::Builder; let dic = Builder::lang("nl_NL").build().unwrap(); assert_eq!(dic.inserted_with("lettergrepen", "."), "let.ter.gre.pen");
pub fn inserted(&self, word: &str) -> String
[src]
Get the word as a string with all the possible hyphens inserted.
- word - unicode string of the word to hyphenate
Example
use pyphen_rs::Builder; let dic = Builder::lang("nl_NL").build().unwrap(); assert_eq!(dic.inserted("lettergrepen"), "let-ter-gre-pen");
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,