[][src]Struct pyphen_rs::Pyphen

pub struct Pyphen { /* fields omitted */ }

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]

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]

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

impl !Send for Pyphen

impl !Sync for Pyphen

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]