Skip to main content

StringOps

Struct StringOps 

Source
pub struct StringOps;
Expand description

Operations on string objects.

Implementations§

Source§

impl StringOps

Source

pub fn byte_len(obj: &RtObject) -> Option<usize>

Get the length of a string in bytes.

Source

pub fn char_len(obj: &RtObject) -> Option<usize>

Get the length of a string in characters.

Source

pub fn as_str(obj: &RtObject) -> Option<String>

Get the string value.

Source

pub fn concat(a: &RtObject, b: &RtObject) -> Option<RtObject>

Concatenate two strings.

Source

pub fn char_at(obj: &RtObject, index: usize) -> Option<RtObject>

Get a character at an index.

Source

pub fn substring(obj: &RtObject, start: usize, len: usize) -> Option<RtObject>

Take a substring.

Source

pub fn to_char_list(obj: &RtObject) -> Option<Vec<RtObject>>

Convert a string to a list of characters.

Source

pub fn nat_to_string(n: &RtObject) -> Option<RtObject>

Convert a natural number to its string representation.

Source

pub fn push_char(s: &RtObject, c: &RtObject) -> Option<RtObject>

Append a character to a string.

Auto Trait Implementations§

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, 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.