Struct pascal_string::PascalString [] [src]

pub struct PascalString { /* fields omitted */ }

An owned PascalString. This string type stores its data the stack. It is always 256 bytes long, with the first byte storing the length.

This string type uses Ascii encoding.

Methods

impl PascalString
[src]

[src]

Creates a new, empty PascalString.

[src]

Create a new PascalString from its constituent parts: string_len and char_array.

Returns an Err if char_array is not valid Ascii.

[src]

Create a new PascalString using the contents of bytes.

Returns an Err if bytes is longer than 255 characters, or it does not contain Ascii encoded characters.

[src]

Push an ascii convertible character onto this string.

Panics

Panics if the string is full, of if the character is not a valid ascii character.

[src]

Attempt to push an ascii convertible character onto the end of this PascalString.

Returns Err(_) if the character cannot be pushed because this PascalString is full, or if character is not a valid ascii character.

[src]

Append a given string slice onto the end of this PascalString.

Panics

Panics if the string cannot be pushed to because this PascalString is full.

[src]

Attempt to append a given string slice onto the end of this PascalString.

Returns Err(_) if the string cannot be pushed because this PascalString is full.

[src]

Removes the last character from the string buffer and returns it.

Returns None if this PascalString is empty.

[src]

Remove a character from the AsciiString at index.

Panics

Panics if index is larger than self.len(), or if self.is_empty() is true.

[src]

Insert a character into the AsciiString at index.

Panics

Panics if index is larger than self.len(), or if the PascalString is full.

[src]

Truncates this String, removing all contents.

Does not zero the values of the string.

[src]

Consumes this PascalString, and returns its inner state as a [u8; 256], where the first byte is the length.

Note that if the string has been truncated, bytes beyond the end of the string will not have been zeroed.

Methods from Deref<Target = PascalStr>

[src]

Get a pointer to the first byte of the string buffer.

[src]

Get a mutable pointer to the first byte of the string buffer.

[src]

Get the PascalStr as an immutable &str reference.

[src]

Get this string as a CStr.

Returns Err(InteriorNullError) if the string contains any interior nulls. If this string is full, then a new CString will be allocated to hold the trailing null byte.

[src]

Returns the number of characters used in the string.

[src]

Returns true if the string has a length of 0

[src]

Returns true if the string has a length of 255.

When this value is true, no more elements can be pushed onto the string.

Important traits for Chars<'a>
[src]

Get an immutable iterator to the internal character array.

Important traits for CharsMut<'a>
[src]

Get a mutable iterator to the internal character array.

Important traits for Lines<'a>
[src]

Get an iterator over the lines of the internal character array.

[src]

Get a character in the string, without checking if the index is within the bounds of len().

This method cannot cause memory unsafety because index is bounds checked within the maximum possible length of the PascalStr, which means that it cannot read uninitialised memory. However, it can give access to stale characters if index is greater than or equal to self.len() or isize::MAX, and self.is_full() is false.

Panics

This method will panic if index is larger than u8::MAX(255).

Trait Implementations

impl Eq for PascalString
[src]

impl Default for PascalString
[src]

[src]

Returns the "default value" for a type. Read more

impl Clone for PascalString
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<S: AsRef<PascalStr> + ?Sized> PartialEq<S> for PascalString
[src]

[src]

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

1.0.0
[src]

This method tests for !=.

impl Ord for PascalString
[src]

[src]

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

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<S: AsRef<PascalStr> + ?Sized> PartialOrd<S> for PascalString
[src]

[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

impl Hash for PascalString
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

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

impl AsciiExt for PascalString
[src]

Container type for copied ASCII characters.

[src]

Checks if the value is within the ASCII range. Read more

[src]

Makes a copy of the value in its ASCII upper case equivalent. Read more

[src]

Makes a copy of the value in its ASCII lower case equivalent. Read more

[src]

Checks that two values are an ASCII case-insensitive match. Read more

[src]

Converts this type to its ASCII upper case equivalent in-place. Read more

[src]

Converts this type to its ASCII lower case equivalent in-place. Read more

[src]

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

Checks if the value is an ASCII alphabetic character: U+0041 'A' ... U+005A 'Z' or U+0061 'a' ... U+007A 'z'. For strings, true if all characters in the string are ASCII alphabetic. Read more

[src]

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

Checks if the value is an ASCII uppercase character: U+0041 'A' ... U+005A 'Z'. For strings, true if all characters in the string are ASCII uppercase. Read more

[src]

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

Checks if the value is an ASCII lowercase character: U+0061 'a' ... U+007A 'z'. For strings, true if all characters in the string are ASCII lowercase. Read more

[src]

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

Checks if the value is an ASCII alphanumeric character: U+0041 'A' ... U+005A 'Z', U+0061 'a' ... U+007A 'z', or U+0030 '0' ... U+0039 '9'. For strings, true if all characters in the string are ASCII alphanumeric. Read more

[src]

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

Checks if the value is an ASCII decimal digit: U+0030 '0' ... U+0039 '9'. For strings, true if all characters in the string are ASCII digits. Read more

[src]

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

Checks if the value is an ASCII hexadecimal digit: U+0030 '0' ... U+0039 '9', U+0041 'A' ... U+0046 'F', or U+0061 'a' ... U+0066 'f'. For strings, true if all characters in the string are ASCII hex digits. Read more

[src]

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

Checks if the value is an ASCII punctuation character: Read more

[src]

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

Checks if the value is an ASCII graphic character: U+0021 '!' ... U+007E '~'. For strings, true if all characters in the string are ASCII graphic characters. Read more

[src]

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

Checks if the value is an ASCII whitespace character: U+0020 SPACE, U+0009 HORIZONTAL TAB, U+000A LINE FEED, U+000C FORM FEED, or U+000D CARRIAGE RETURN. For strings, true if all characters in the string are ASCII whitespace. Read more

[src]

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

Checks if the value is an ASCII control character: U+0000 NUL ... U+001F UNIT SEPARATOR, or U+007F DELETE. Note that most ASCII whitespace characters are control characters, but SPACE is not. Read more

impl Debug for PascalString
[src]

[src]

Formats the value using the given formatter. Read more

impl Display for PascalString
[src]

[src]

Formats the value using the given formatter. Read more

impl Deref for PascalString
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.

impl DerefMut for PascalString
[src]

[src]

Mutably dereferences the value.

impl AsRef<PascalStr> for PascalString
[src]

[src]

Performs the conversion.

impl AsRef<str> for PascalString
[src]

[src]

Performs the conversion.

impl AsRef<[u8]> for PascalString
[src]

[src]

Performs the conversion.

impl AsRef<AsciiStr> for PascalString
[src]

[src]

Performs the conversion.

impl AsRef<[AsciiChar]> for PascalString
[src]

[src]

Performs the conversion.

impl AsMut<[AsciiChar]> for PascalString
[src]

[src]

Performs the conversion.

impl Borrow<PascalStr> for PascalString
[src]

[src]

Immutably borrows from an owned value. Read more

impl BorrowMut<PascalStr> for PascalString
[src]

[src]

Mutably borrows from an owned value. Read more

impl Borrow<str> for PascalString
[src]

[src]

Immutably borrows from an owned value. Read more

impl Borrow<[u8]> for PascalString
[src]

[src]

Immutably borrows from an owned value. Read more

impl Borrow<AsciiStr> for PascalString
[src]

[src]

Immutably borrows from an owned value. Read more

impl Borrow<[AsciiChar]> for PascalString
[src]

[src]

Immutably borrows from an owned value. Read more

impl BorrowMut<[AsciiChar]> for PascalString
[src]

[src]

Mutably borrows from an owned value. Read more

impl Into<[u8; 256]> for PascalString
[src]

[src]

Performs the conversion.

impl Into<String> for PascalString
[src]

[src]

Performs the conversion.

impl Into<Vec<u8>> for PascalString
[src]

[src]

Performs the conversion.

impl Into<Vec<AsciiChar>> for PascalString
[src]

[src]

Performs the conversion.

impl Into<AsciiString> for PascalString
[src]

[src]

Performs the conversion.

impl FromStr for PascalString
[src]

The associated error which can be returned from parsing.

[src]

Parses a string s to return a value of this type. Read more

impl FromIterator<AsciiChar> for PascalString
[src]

[src]

Creates a value from an iterator. Read more

impl IntoIterator for PascalString
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

[src]

Creates an iterator from a value. Read more

Auto Trait Implementations

impl Send for PascalString

impl Sync for PascalString