Struct pascal_string::PascalStr
[−]
[src]
pub struct PascalStr { /* fields omitted */ }
A borrowed slice from a PascalString
. Does not own its data.
Methods
impl PascalStr
[src]
pub fn as_ptr(&self) -> *const AsciiChar
[src]
Get a pointer to the first byte of the string buffer.
pub fn as_mut_ptr(&mut self) -> *mut AsciiChar
[src]
Get a mutable pointer to the first byte of the string buffer.
pub fn as_str(&self) -> &str
[src]
Get the PascalStr
as an immutable &str
reference.
pub fn as_cstr(&self) -> Result<Cow<CStr>, InteriorNullError>
[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.
pub fn len(&self) -> usize
[src]
Returns the number of characters used in the string.
pub fn is_empty(&self) -> bool
[src]
Returns true if the string has a length of 0
pub fn is_full(&self) -> bool
[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>pub fn chars<'a>(&'a self) -> Chars<'a>
[src]
Get an immutable iterator to the internal character array.
ⓘImportant traits for CharsMut<'a>pub fn chars_mut<'a>(&'a mut self) -> CharsMut<'a>
[src]
Get a mutable iterator to the internal character array.
ⓘImportant traits for Lines<'a>pub fn lines(&self) -> Lines
[src]
Get an iterator over the lines of the internal character array.
pub fn get_unchecked(&self, index: usize) -> AsciiChar
[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 PascalStr
[src]
impl Hash for PascalStr
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Ord for PascalStr
[src]
fn cmp(&self, __arg_0: &PascalStr) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl<S: AsRef<PascalStr> + ?Sized> PartialEq<S> for PascalStr
[src]
fn eq(&self, other: &S) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<S: AsRef<PascalStr> + ?Sized> PartialOrd<S> for PascalStr
[src]
fn partial_cmp(&self, other: &S) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
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 AsciiExt for PascalStr
[src]
type Owned = PascalString
Container type for copied ASCII characters.
fn is_ascii(&self) -> bool
[src]
Checks if the value is within the ASCII range. Read more
fn to_ascii_uppercase(&self) -> Self::Owned
[src]
Makes a copy of the value in its ASCII upper case equivalent. Read more
fn to_ascii_lowercase(&self) -> Self::Owned
[src]
Makes a copy of the value in its ASCII lower case equivalent. Read more
fn eq_ignore_ascii_case(&self, other: &Self) -> bool
[src]
Checks that two values are an ASCII case-insensitive match. Read more
fn make_ascii_uppercase(&mut self)
[src]
Converts this type to its ASCII upper case equivalent in-place. Read more
fn make_ascii_lowercase(&mut self)
[src]
Converts this type to its ASCII lower case equivalent in-place. Read more
fn is_ascii_alphabetic(&self) -> bool
[src]
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
fn is_ascii_uppercase(&self) -> bool
[src]
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
fn is_ascii_lowercase(&self) -> bool
[src]
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
fn is_ascii_alphanumeric(&self) -> bool
[src]
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
fn is_ascii_digit(&self) -> bool
[src]
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
fn is_ascii_hexdigit(&self) -> bool
[src]
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
fn is_ascii_punctuation(&self) -> bool
[src]
ascii_ctype
)Checks if the value is an ASCII punctuation character: Read more
fn is_ascii_graphic(&self) -> bool
[src]
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
fn is_ascii_whitespace(&self) -> bool
[src]
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
fn is_ascii_control(&self) -> bool
[src]
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 PascalStr
[src]
fn fmt(&self, fmtr: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Display for PascalStr
[src]
fn fmt(&self, fmtr: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl ToOwned for PascalStr
[src]
type Owned = PascalString
fn to_owned(&self) -> Self::Owned
[src]
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut Self::Owned)
[src]
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl AsRef<PascalStr> for PascalStr
[src]
impl AsRef<str> for PascalStr
[src]
impl AsRef<[u8]> for PascalStr
[src]
impl AsRef<AsciiStr> for PascalStr
[src]
impl AsMut<AsciiStr> for PascalStr
[src]
impl AsRef<[AsciiChar]> for PascalStr
[src]
impl AsMut<[AsciiChar]> for PascalStr
[src]
impl Index<u8> for PascalStr
[src]
type Output = AsciiChar
The returned type after indexing.
fn index(&self, index: u8) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl IndexMut<u8> for PascalStr
[src]
fn index_mut(&mut self, index: u8) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl Index<usize> for PascalStr
[src]
type Output = AsciiChar
The returned type after indexing.
fn index(&self, index: usize) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl IndexMut<usize> for PascalStr
[src]
fn index_mut(&mut self, index: usize) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl Index<i32> for PascalStr
[src]
type Output = AsciiChar
The returned type after indexing.
fn index(&self, index: i32) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl IndexMut<i32> for PascalStr
[src]
fn index_mut(&mut self, index: i32) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl Index<RangeFull> for PascalStr
[src]
type Output = [AsciiChar]
The returned type after indexing.
fn index(&self, _: RangeFull) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl IndexMut<RangeFull> for PascalStr
[src]
fn index_mut(&mut self, _: RangeFull) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl Index<Range<u8>> for PascalStr
[src]
type Output = [AsciiChar]
The returned type after indexing.
fn index(&self, range: Range<u8>) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl IndexMut<Range<u8>> for PascalStr
[src]
fn index_mut(&mut self, range: Range<u8>) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl Index<Range<usize>> for PascalStr
[src]
type Output = [AsciiChar]
The returned type after indexing.
fn index(&self, range: Range<usize>) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl IndexMut<Range<usize>> for PascalStr
[src]
fn index_mut(&mut self, range: Range<usize>) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl Index<Range<i32>> for PascalStr
[src]
type Output = [AsciiChar]
The returned type after indexing.
fn index(&self, range: Range<i32>) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl IndexMut<Range<i32>> for PascalStr
[src]
fn index_mut(&mut self, range: Range<i32>) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl Index<RangeFrom<u8>> for PascalStr
[src]
type Output = [AsciiChar]
The returned type after indexing.
fn index(&self, range: RangeFrom<u8>) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl IndexMut<RangeFrom<u8>> for PascalStr
[src]
fn index_mut(&mut self, range: RangeFrom<u8>) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl Index<RangeFrom<usize>> for PascalStr
[src]
type Output = [AsciiChar]
The returned type after indexing.
fn index(&self, range: RangeFrom<usize>) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl IndexMut<RangeFrom<usize>> for PascalStr
[src]
fn index_mut(&mut self, range: RangeFrom<usize>) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl Index<RangeFrom<i32>> for PascalStr
[src]
type Output = [AsciiChar]
The returned type after indexing.
fn index(&self, range: RangeFrom<i32>) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl IndexMut<RangeFrom<i32>> for PascalStr
[src]
fn index_mut(&mut self, range: RangeFrom<i32>) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl Index<RangeTo<u8>> for PascalStr
[src]
type Output = [AsciiChar]
The returned type after indexing.
fn index(&self, range: RangeTo<u8>) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl IndexMut<RangeTo<u8>> for PascalStr
[src]
fn index_mut(&mut self, range: RangeTo<u8>) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl Index<RangeTo<usize>> for PascalStr
[src]
type Output = [AsciiChar]
The returned type after indexing.
fn index(&self, range: RangeTo<usize>) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl IndexMut<RangeTo<usize>> for PascalStr
[src]
fn index_mut(&mut self, range: RangeTo<usize>) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl Index<RangeTo<i32>> for PascalStr
[src]
type Output = [AsciiChar]
The returned type after indexing.
fn index(&self, range: RangeTo<i32>) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl IndexMut<RangeTo<i32>> for PascalStr
[src]
fn index_mut(&mut self, range: RangeTo<i32>) -> &mut Self::Output
[src]
Performs the mutable indexing (container[index]
) operation.
impl<'a> IntoIterator for &'a PascalStr
[src]
type Item = &'a AsciiChar
The type of the elements being iterated over.
type IntoIter = Chars<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl<'a> IntoIterator for &'a mut PascalStr
[src]
type Item = &'a mut AsciiChar
The type of the elements being iterated over.
type IntoIter = CharsMut<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl AsRef<PascalStr> for PascalString
[src]
impl Borrow<PascalStr> for PascalString
[src]
impl BorrowMut<PascalStr> for PascalString
[src]
fn borrow_mut(&mut self) -> &mut PascalStr
[src]
Mutably borrows from an owned value. Read more