pub struct fstr<const N: usize> { /* private fields */ }
Expand description

main type: string of size up to const N:

Implementations

creates a new fstr with given &str. If the length of s exceeds N, the extra characters are ignored. This function is also called by several others including fstr::from.

creates an empty string, equivalent to fstr::default()

length of the string in bytes, which will be up to the maximum size N. This is a constant-time operation. Note that this value is consistent with str::len

returns maximum capacity in bytes

converts fstr to an owned string

allows returns copy of u8 array underneath the fstr

converts fstr to &str using std::str::from_utf8

alias for fstr::to_str

changes a character at character position i to c. This function requires that c is in the same character class (ascii or unicode) as the char being replaced. It never shuffles the bytes underneath. The function returns true if the change was successful.

adds chars to end of current string up to maximum size N of fstr, returns the portion of the push string that was NOT pushed due to capacity, so if “” is returned then all characters were pushed successfully.

returns the number of characters in the string regardless of character class

returns the nth char of the fstr

returns the nth byte of the string as a char. This function should only be called on ascii strings. It is designed to be quicker than fstr::nth, and does not check array bounds or check n against the length of the string. Nor does it check if the value returned is within the ascii range.

determines if string is an ascii string

shortens the fstr in-place (mutates). If n is greater than the current length of the string in chars, this operation will have no effect.

converts an fstr<M> to an fstr<N>. If the length of the string being converted is greater than N, the extra characters will be ignored. This operation produces a copy (non-destructive). Example:

  let s1:fstr<8> = fstr::from("abcdefg");
  let s2:fstr<16> = s1.resize(); 

mimics same function on str

mimics same function on str

returns a copy of the portion of the string, string could be truncated if indices are out of range. Similar to slice [start..end]

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

defaults to empty string

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

creates a new fstr with given &str. If the length of s exceeds N, the extra characters are ignored.

creates a new fstr with given &str. If the length of s exceeds N, the extra characters are ignored.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Convert fstr to &u8 slice

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.