pub struct rune(_, _);
Expand description
The rune
type represents a user-perceived character.
Implementations
sourceimpl rune
impl rune
sourcepub fn from_char(ch: char) -> Option<Self>
pub fn from_char(ch: char) -> Option<Self>
Convert a char
to rune
, returning None
if it could not form a complete rune.
sourcepub fn from_char_lossy(ch: char) -> Self
pub fn from_char_lossy(ch: char) -> Self
Convert a char
to rune
, modifying text to form a complete rune if necessary.
See crate documentation for more details on this.
sourcepub fn from_grapheme_cluster(grapheme: &str) -> Option<Self>
pub fn from_grapheme_cluster(grapheme: &str) -> Option<Self>
Convert a &str
consisting of a grapheme cluster to rune
,
returning None
if the input is not exactly a grapheme cluster or
it could not form a complete rune.
sourcepub fn from_grapheme_cluster_lossy(grapheme: &str) -> Option<Self>
pub fn from_grapheme_cluster_lossy(grapheme: &str) -> Option<Self>
Convert a &str
consisting of a grapheme cluster to rune
,
tweaking the text a little if necessary,
or returning None
if the input is not exactly a grapheme cluster.
sourcepub fn from_inner(v: u32) -> Option<Self>
pub fn from_inner(v: u32) -> Option<Self>
Constructs a rune
from its internal representation.
sourcepub fn into_inner(self) -> u32
pub fn into_inner(self) -> u32
Retrieves the internal representation of this rune
.
sourcepub fn into_char(self) -> Option<char>
pub fn into_char(self) -> Option<char>
Retrieves the char this rune corresponds to. Returns None
if it corresponds to the combination of
multiple chars.
sourcepub fn into_chars(self) -> CharsⓘNotable traits for Charsimpl Iterator for Chars type Item = char;
pub fn into_chars(self) -> CharsⓘNotable traits for Charsimpl Iterator for Chars type Item = char;
Retrieves an iterator that iterate over the list of the chars this rune corresponds to.
sourcepub fn len_runestr(self) -> usize
pub fn len_runestr(self) -> usize
Returns the number of bytes this char would need if encoded in RuneStr
.
That number of bytes is always between 1 and 6, inclusive.
sourcepub fn encode_runestr(self, dst: &mut [u8]) -> &mut RuneStr
pub fn encode_runestr(self, dst: &mut [u8]) -> &mut RuneStr
Encode this rune as RuneStr into the provided byte buffer, and then returns the subslice of the buffer that contains the encoded rune.
Panics
Panics if the buffer is not large enough.
A buffer of length six is large enough to encode any rune
.
Trait Implementations
sourceimpl Extend<rune> for RuneString
impl Extend<rune> for RuneString
sourcefn extend<T: IntoIterator<Item = rune>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = rune>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl FromIterator<rune> for RuneString
impl FromIterator<rune> for RuneString
sourcefn from_iter<T: IntoIterator<Item = rune>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = rune>>(iter: T) -> Self
Creates a value from an iterator. Read more
impl Copy for rune
impl Eq for rune
impl StructuralEq for rune
impl StructuralPartialEq for rune
Auto Trait Implementations
impl RefUnwindSafe for rune
impl !Send for rune
impl !Sync for rune
impl Unpin for rune
impl UnwindSafe for rune
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more