pub struct RuneParts {
pub ptr: *const u8,
pub length: usize,
}Expand description
Represents a memory area with contiguous bytes that serves as building block for Runes and Rune.
Β§Examples
use utf8_rune::{RuneParts, Rune, Runes};
let parts = RuneParts::new("πππ»ππΌππ½ππΎππΏ");
assert_eq!(parts.len(), 44);
assert_eq!(parts.as_str(), "πππ»ππΌππ½ππΎππΏ");
assert_eq!(parts.as_bytes(), "πππ»ππΌππ½ππΎππΏ".as_bytes());
let runes = parts.into_runes();
assert_eq!(runes.len(), 6);
assert_eq!(runes[0], "π");
assert_eq!(runes[1], "ππ»");
assert_eq!(runes[2], "ππΌ");
assert_eq!(runes[3], "ππ½");
assert_eq!(runes[4], "ππΎ");
assert_eq!(runes[5], "ππΏ");FieldsΒ§
Β§ptr: *const u8Β§length: usizeImplementationsΒ§
SourceΒ§impl RuneParts
impl RuneParts
pub fn from_raw_parts(ptr: *const u8, length: usize) -> RuneParts
pub fn new<T: Display>(input: T) -> RuneParts
pub fn into_runes<'g>(self) -> Runes<'g>
pub fn allocate<T: Display>(input: T) -> Result<RuneParts>
pub fn rune(&self) -> Option<Rune>
pub fn indexes(&self) -> Vec<usize>
pub fn rune_at_index(&self, index: usize) -> Result<Rune>
pub fn runes(&self) -> Result<Vec<Rune>>
pub fn len(&self) -> usize
pub fn as_str<'g>(&self) -> &'g str
pub fn as_bytes<'g>(&self) -> &'g [u8] β
pub fn is_empty(&self) -> bool
pub fn as_debug(&self, indent: Option<usize>) -> String
Trait ImplementationsΒ§
impl Copy for RuneParts
Auto Trait ImplementationsΒ§
impl Freeze for RuneParts
impl RefUnwindSafe for RuneParts
impl !Send for RuneParts
impl !Sync for RuneParts
impl Unpin for RuneParts
impl UnwindSafe for RuneParts
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