[][src]Struct arraystring::ArrayString

pub struct ArrayString<SIZE: Capacity> { /* fields omitted */ }

String based on a generic array (size defined at compile time through typenum)

Can't outgrow capacity (defined at compile time), always occupies capacity + 1 bytes of memory

Doesn't allocate memory on the heap and never panics (all panic branches are stripped at compile time)

Methods

impl<SIZE: Capacity> ArrayString<SIZE>
[src]

pub fn new() -> Self
[src]

Creates new empty string.

let string = SmallString::new();
assert!(string.is_empty());

pub fn try_from_str<S>(s: S) -> Result<Self, OutOfBounds> where
    S: AsRef<str>, 
[src]

Creates new ArrayString from string slice if length is lower or equal to capacity, otherwise returns an error.

let string = SmallString::try_from_str("My String")?;
assert_eq!(string.as_str(), "My String");

assert_eq!(SmallString::try_from_str("")?.as_str(), "");

let out_of_bounds = "0".repeat(SmallString::capacity() as usize + 1);
assert!(SmallString::try_from_str(out_of_bounds).is_err());

pub fn from_str_truncate<S>(string: S) -> Self where
    S: AsRef<str>, 
[src]

Creates new ArrayString from string slice truncating size if bigger than capacity.

let string = SmallString::from_str_truncate("My String");
println!("{}", string);

let truncate = "0".repeat(SmallString::capacity() as usize + 1);
let truncated = "0".repeat(SmallString::capacity().into());
let string = SmallString::from_str_truncate(&truncate);
assert_eq!(string.as_str(), truncated);

pub unsafe fn from_str_unchecked<S>(string: S) -> Self where
    S: AsRef<str>, 
[src]

Creates new ArrayString from string slice assuming length is appropriate.

Safety

It's UB if string.len() > capacity.

let filled = "0".repeat(SmallString::capacity().into());
let string = unsafe {
    SmallString::from_str_unchecked(&filled)
};
assert_eq!(string.as_str(), filled.as_str());

// Undefined behavior, don't do it
// let out_of_bounds = "0".repeat(SmallString::capacity().into() + 1);
// let ub = unsafe { SmallString::from_str_unchecked(out_of_bounds) };

pub fn try_from_iterator<U, I>(iter: I) -> Result<Self, OutOfBounds> where
    U: AsRef<str>,
    I: IntoIterator<Item = U>, 
[src]

Creates new ArrayString from string slice iterator if total length is lower or equal to capacity, otherwise returns an error.

let string = MaxString::try_from_iterator(&["My String", " My Other String"][..])?;
assert_eq!(string.as_str(), "My String My Other String");

let out_of_bounds = (0..100).map(|_| "000");
assert!(SmallString::try_from_iterator(out_of_bounds).is_err());

pub fn from_iterator<U, I>(iter: I) -> Self where
    U: AsRef<str>,
    I: IntoIterator<Item = U>, 
[src]

Creates new ArrayString from string slice iterator truncating size if bigger than capacity.

let string = MaxString::from_iterator(&["My String", " Other String"][..]);
assert_eq!(string.as_str(), "My String Other String");

let out_of_bounds = (0..400).map(|_| "000");
let truncated = "0".repeat(SmallString::capacity().into());

let truncate = SmallString::from_iterator(out_of_bounds);
assert_eq!(truncate.as_str(), truncated.as_str());

pub unsafe fn from_iterator_unchecked<U, I>(iter: I) -> Self where
    U: AsRef<str>,
    I: IntoIterator<Item = U>, 
[src]

Creates new ArrayString from string slice iterator assuming length is appropriate.

Safety

It's UB if iter.map(|c| c.len()).sum() > capacity.

let string = unsafe {
    MaxString::from_iterator_unchecked(&["My String", " My Other String"][..])
};
assert_eq!(string.as_str(), "My String My Other String");

// Undefined behavior, don't do it
// let out_of_bounds = (0..400).map(|_| "000");
// let undefined_behavior = unsafe {
//     SmallString::from_iterator_unchecked(out_of_bounds)
// };

pub fn try_from_chars<I>(iter: I) -> Result<Self, OutOfBounds> where
    I: IntoIterator<Item = char>, 
[src]

Creates new ArrayString from char iterator if total length is lower or equal to capacity, otherwise returns an error.

let string = SmallString::try_from_chars("My String".chars())?;
assert_eq!(string.as_str(), "My String");

let out_of_bounds = "0".repeat(SmallString::capacity() as usize + 1);
assert!(SmallString::try_from_chars(out_of_bounds.chars()).is_err());

pub fn from_chars<I>(iter: I) -> Self where
    I: IntoIterator<Item = char>, 
[src]

Creates new ArrayString from char iterator truncating size if bigger than capacity.

let string = SmallString::from_chars("My String".chars());
assert_eq!(string.as_str(), "My String");

let out_of_bounds = "0".repeat(SmallString::capacity() as usize + 1);
let truncated = "0".repeat(SmallString::capacity().into());

let truncate = SmallString::from_chars(out_of_bounds.chars());
assert_eq!(truncate.as_str(), truncated.as_str());

pub unsafe fn from_chars_unchecked<I>(iter: I) -> Self where
    I: IntoIterator<Item = char>, 
[src]

Creates new ArrayString from char iterator assuming length is appropriate.

Safety

It's UB if iter.map(|c| c.len_utf8()).sum() > capacity.

let string = unsafe { SmallString::from_chars_unchecked("My String".chars()) };
assert_eq!(string.as_str(), "My String");

// Undefined behavior, don't do it
// let out_of_bounds = "000".repeat(400);
// let undefined_behavior = unsafe { SmallString::from_chars_unchecked(out_of_bounds.chars()) };

pub fn try_from_utf8<B>(slice: B) -> Result<Self, Error> where
    B: AsRef<[u8]>, 
[src]

Creates new ArrayString from byte slice, returning Utf8 on invalid utf-8 data or OutOfBounds if bigger than capacity

let string = SmallString::try_from_utf8("My String")?;
assert_eq!(string.as_str(), "My String");

let invalid_utf8 = [0, 159, 146, 150];
assert_eq!(SmallString::try_from_utf8(invalid_utf8), Err(Error::Utf8));

let out_of_bounds = "0000".repeat(400);
assert_eq!(SmallString::try_from_utf8(out_of_bounds.as_bytes()), Err(Error::OutOfBounds));

pub fn from_utf8<B>(slice: B) -> Result<Self, Utf8> where
    B: AsRef<[u8]>, 
[src]

Creates new ArrayString from byte slice, returning Utf8 on invalid utf-8 data, truncating if bigger than capacity.

let string = SmallString::from_utf8("My String")?;
assert_eq!(string.as_str(), "My String");

let invalid_utf8 = [0, 159, 146, 150];
assert_eq!(SmallString::from_utf8(invalid_utf8), Err(Utf8));

let out_of_bounds = "0".repeat(300);
assert_eq!(SmallString::from_utf8(out_of_bounds.as_bytes())?.as_str(),
           "0".repeat(SmallString::capacity().into()).as_str());

pub unsafe fn from_utf8_unchecked<B>(slice: B) -> Self where
    B: AsRef<[u8]>, 
[src]

Creates new ArrayString from byte slice assuming it's utf-8 and of a appropriate size.

Safety

It's UB if slice is not a valid utf-8 string or slice.len() > capacity.

let string = unsafe { SmallString::from_utf8_unchecked("My String") };
assert_eq!(string.as_str(), "My String");

// Undefined behavior, don't do it
// let out_of_bounds = "0".repeat(300);
// let ub = unsafe { SmallString::from_utf8_unchecked(out_of_bounds)) };

pub fn try_from_utf16<B>(slice: B) -> Result<Self, Error> where
    B: AsRef<[u16]>, 
[src]

Creates new ArrayString from u16 slice, returning Utf16 on invalid utf-16 data or OutOfBounds if bigger than capacity

let music = [0xD834, 0xDD1E, 0x006d, 0x0075, 0x0073, 0x0069, 0x0063];
let string = SmallString::try_from_utf16(music)?;
assert_eq!(string.as_str(), "𝄞music");

let invalid_utf16 = [0xD834, 0xDD1E, 0x006d, 0x0075, 0xD800, 0x0069, 0x0063];
assert_eq!(SmallString::try_from_utf16(invalid_utf16), Err(Error::Utf16));

let out_of_bounds: Vec<_> = (0..300).map(|_| 0).collect();
assert_eq!(SmallString::try_from_utf16(out_of_bounds), Err(Error::OutOfBounds));

pub fn from_utf16<B>(slice: B) -> Result<Self, Utf16> where
    B: AsRef<[u16]>, 
[src]

Creates new ArrayString from u16 slice, returning Utf16 on invalid utf-16 data, truncating if bigger than capacity.

let music = [0xD834, 0xDD1E, 0x006d, 0x0075, 0x0073, 0x0069, 0x0063];
let string = SmallString::from_utf16(music)?;
assert_eq!(string.as_str(), "𝄞music");

let invalid_utf16 = [0xD834, 0xDD1E, 0x006d, 0x0075, 0xD800, 0x0069, 0x0063];
assert_eq!(SmallString::from_utf16(invalid_utf16), Err(Utf16));

let out_of_bounds: Vec<u16> = (0..300).map(|_| 0).collect();
assert_eq!(SmallString::from_utf16(out_of_bounds)?.as_str(),
           "\0".repeat(SmallString::capacity().into()).as_str());

pub fn from_utf16_lossy<B>(slice: B) -> Self where
    B: AsRef<[u16]>, 
[src]

Creates new ArrayString from u16 slice, replacing invalid utf-16 data with REPLACEMENT_CHARACTER (\u{FFFD}) and truncating size if bigger than capacity

let music = [0xD834, 0xDD1E, 0x006d, 0x0075, 0x0073, 0x0069, 0x0063];
let string = SmallString::from_utf16_lossy(music);
assert_eq!(string.as_str(), "𝄞music");

let invalid_utf16 = [0xD834, 0xDD1E, 0x006d, 0x0075, 0xD800, 0x0069, 0x0063];
assert_eq!(SmallString::from_utf16_lossy(invalid_utf16).as_str(), "𝄞mu\u{FFFD}ic");

let out_of_bounds: Vec<u16> = (0..300).map(|_| 0).collect();
assert_eq!(SmallString::from_utf16_lossy(&out_of_bounds).as_str(),
           "\0".repeat(SmallString::capacity().into()).as_str());

pub fn as_str(&self) -> &str
[src]

Extracts a string slice containing the entire ArrayString

let s = SmallString::try_from_str("My String")?;
assert_eq!(s.as_str(), "My String");

pub fn as_mut_str(&mut self) -> &mut str
[src]

Extracts a mutable string slice containing the entire ArrayString

let mut s = SmallString::try_from_str("My String")?;
assert_eq!(s.as_mut_str(), "My String");

pub fn as_bytes(&self) -> &[u8]
[src]

Extracts a byte slice containing the entire ArrayString

let s = SmallString::try_from_str("My String")?;
assert_eq!(s.as_bytes(), "My String".as_bytes());

pub unsafe fn as_mut_bytes(&mut self) -> &mut [u8]
[src]

Extracts a mutable string slice containing the entire ArrayString

let mut s = SmallString::try_from_str("My String")?;
assert_eq!(unsafe { s.as_mut_bytes() }, "My String".as_bytes());

pub fn capacity() -> u8
[src]

Returns maximum string capacity, defined at compile time, it will never change

assert_eq!(ArrayString::<typenum::U32>::capacity(), 32);

pub fn try_push_str<S>(&mut self, string: S) -> Result<(), OutOfBounds> where
    S: AsRef<str>, 
[src]

Pushes string slice to the end of the ArrayString if total size is lower or equal to capacity, otherwise returns an error.

let mut s = MaxString::try_from_str("My String")?;
s.try_push_str(" My other String")?;
assert_eq!(s.as_str(), "My String My other String");

assert!(s.try_push_str("0".repeat(MaxString::capacity().into())).is_err());

pub fn push_str<S>(&mut self, string: S) where
    S: AsRef<str>, 
[src]

Pushes string slice to the end of the ArrayString truncating total size if bigger than capacity.

let mut s = MaxString::try_from_str("My String")?;
s.push_str(" My other String");
assert_eq!(s.as_str(), "My String My other String");

let mut s = SmallString::default();
s.push_str("0".repeat(SmallString::capacity() as usize + 1));
assert_eq!(s.as_str(), "0".repeat(SmallString::capacity().into()).as_str());

pub unsafe fn push_str_unchecked<S>(&mut self, string: S) where
    S: AsRef<str>, 
[src]

Pushes string slice to the end of the ArrayString assuming total size is appropriate.

Safety

It's UB if self.len() + string.len() > capacity.

let mut s = MaxString::try_from_str("My String")?;
unsafe { s.push_str_unchecked(" My other String") };
assert_eq!(s.as_str(), "My String My other String");

// Undefined behavior, don't do it
// let mut undefined_behavior = SmallString::default();
// undefined_behavior.push_str_unchecked("0".repeat(SmallString::capacity().into() + 1));

pub fn try_push(&mut self, character: char) -> Result<(), OutOfBounds>
[src]

Inserts character to the end of the ArrayString erroring if total size if bigger than capacity.

let mut s = SmallString::try_from_str("My String")?;
s.try_push('!')?;
assert_eq!(s.as_str(), "My String!");

let mut s = SmallString::try_from_str(&"0".repeat(SmallString::capacity().into()))?;
assert!(s.try_push('!').is_err());

pub unsafe fn push_unchecked(&mut self, ch: char)
[src]

Inserts character to the end of the ArrayString assuming length is appropriate

Safety

It's UB if self.len() + character.len_utf8() > capacity

let mut s = SmallString::try_from_str("My String")?;
unsafe { s.push_unchecked('!') };
assert_eq!(s.as_str(), "My String!");

// s = SmallString::try_from_str(&"0".repeat(SmallString::capacity().into()))?;
// Undefined behavior, don't do it
// s.push_unchecked('!');

pub fn truncate(&mut self, size: u8) -> Result<(), Utf8>
[src]

Truncates ArrayString to specified size (if smaller than current size and a valid utf-8 char index).

let mut s = SmallString::try_from_str("My String")?;
s.truncate(5)?;
assert_eq!(s.as_str(), "My St");

// Does nothing
s.truncate(6)?;
assert_eq!(s.as_str(), "My St");

// Index is not at a valid char
let mut s = SmallString::try_from_str("🤔")?;
assert!(s.truncate(1).is_err());

pub fn pop(&mut self) -> Option<char>
[src]

Removes last character from ArrayString, if any.

let mut s = SmallString::try_from_str("A🤔")?;
assert_eq!(s.pop(), Some('🤔'));
assert_eq!(s.pop(), Some('A'));
assert_eq!(s.pop(), None);

pub fn trim(&mut self)
[src]

Removes spaces from the beggining and end of the string

let mut string = MaxString::try_from_str("   to be trimmed     ")?;
string.trim();
assert_eq!(string.as_str(), "to be trimmed");

let mut string = SmallString::try_from_str("   🤔")?;
string.trim();
assert_eq!(string.as_str(), "🤔");

pub fn remove(&mut self, idx: u8) -> Result<char, Error>
[src]

Removes specified char from ArrayString

let mut s = SmallString::try_from_str("ABCD🤔")?;
assert_eq!(s.remove("ABCD🤔".len() as u8), Err(Error::OutOfBounds));
assert_eq!(s.remove(10), Err(Error::OutOfBounds));
assert_eq!(s.remove(6), Err(Error::Utf8));
assert_eq!(s.remove(0), Ok('A'));
assert_eq!(s.as_str(), "BCD🤔");
assert_eq!(s.remove(2), Ok('D'));
assert_eq!(s.as_str(), "BC🤔");

pub fn retain<F: FnMut(char) -> bool>(&mut self, f: F)
[src]

Retains only the characters specified by the predicate.

let mut s = SmallString::try_from_str("ABCD🤔")?;
s.retain(|c| c != '🤔');
assert_eq!(s.as_str(), "ABCD");

pub fn try_insert(&mut self, idx: u8, ch: char) -> Result<(), Error>
[src]

Inserts character at specified index, returning error if total length is bigger than capacity.

Returns OutOfBounds if idx is out of bounds and Utf8 if idx is not a char position

let mut s = SmallString::try_from_str("ABCD🤔")?;
s.try_insert(1, 'A')?;
s.try_insert(2, 'B')?;
assert_eq!(s.as_str(), "AABBCD🤔");
assert_eq!(s.try_insert(20, 'C'), Err(Error::OutOfBounds));
assert_eq!(s.try_insert(8, 'D'), Err(Error::Utf8));

let mut s = SmallString::try_from_str(&"0".repeat(SmallString::capacity().into()))?;
assert_eq!(s.try_insert(0, 'C'), Err(Error::OutOfBounds));

pub unsafe fn insert_unchecked(&mut self, idx: u8, ch: char)
[src]

Inserts character at specified index assuming length is appropriate

Safety

It's UB if idx does not lie on a utf-8 char boundary

It's UB if self.len() + character.len_utf8() > capacity

let mut s = SmallString::try_from_str("ABCD🤔")?;
unsafe { s.insert_unchecked(1, 'A') };
unsafe { s.insert_unchecked(1, 'B') };
assert_eq!(s.as_str(), "ABABCD🤔");

// Undefined behavior, don't do it
// s.insert(20, 'C');
// s.insert(8, 'D');

pub fn try_insert_str<S>(&mut self, idx: u8, s: S) -> Result<(), Error> where
    S: AsRef<str>, 
[src]

Inserts string slice at specified index, returning error if total length is bigger than capacity.

Returns OutOfBounds if idx is out of bounds Returns Utf8 if idx is not a char position

let mut s = SmallString::try_from_str("ABCD🤔")?;
s.try_insert_str(1, "AB")?;
s.try_insert_str(1, "BC")?;
assert_eq!(s.try_insert_str(1, "0".repeat(SmallString::capacity().into())),
           Err(Error::OutOfBounds));
assert_eq!(s.as_str(), "ABCABBCD🤔");
assert_eq!(s.try_insert_str(20, "C"), Err(Error::OutOfBounds));
assert_eq!(s.try_insert_str(10, "D"), Err(Error::Utf8));

pub fn insert_str<S>(&mut self, idx: u8, string: S) -> Result<(), Error> where
    S: AsRef<str>, 
[src]

Inserts string slice at specified index, truncating size if bigger than capacity.

Returns OutOfBounds if idx is out of bounds and Utf8 if idx is not a char position

let mut s = SmallString::try_from_str("ABCD🤔")?;
s.insert_str(1, "AB")?;
s.insert_str(1, "BC")?;
assert_eq!(s.as_str(), "ABCABBCD🤔");

assert_eq!(s.insert_str(20, "C"), Err(Error::OutOfBounds));
assert_eq!(s.insert_str(10, "D"), Err(Error::Utf8));

s.clear();
s.insert_str(0, "0".repeat(SmallString::capacity() as usize + 10))?;
assert_eq!(s.as_str(), "0".repeat(SmallString::capacity().into()).as_str());

pub unsafe fn insert_str_unchecked<S>(&mut self, idx: u8, string: S) where
    S: AsRef<str>, 
[src]

Inserts string slice at specified index, assuming total length is appropriate.

Safety

It's UB if idx does not lie on a utf-8 char boundary

It's UB if self.len() + string.len() > capacity

let mut s = SmallString::try_from_str("ABCD🤔")?;
unsafe { s.insert_str_unchecked(1, "AB") };
unsafe { s.insert_str_unchecked(1, "BC") };
assert_eq!(s.as_str(), "ABCABBCD🤔");

// Undefined behavior, don't do it
// unsafe { s.insert_str_unchecked(20, "C") };
// unsafe { s.insert_str_unchecked(10, "D") };
// unsafe { s.insert_str_unchecked(1, "0".repeat(SmallString::capacity().into())) };

pub fn len(&self) -> u8
[src]

Returns ArrayString length.

let mut s = SmallString::try_from_str("ABCD")?;
assert_eq!(s.len(), 4);
s.try_push('🤔')?;
// Emojis use 4 bytes (this is the default rust behavior, length of u8)
assert_eq!(s.len(), 8);

pub fn is_empty(&self) -> bool
[src]

Checks if ArrayString is empty.

let mut s = SmallString::try_from_str("ABCD")?;
assert!(!s.is_empty());
s.clear();
assert!(s.is_empty());

pub fn split_off(&mut self, at: u8) -> Result<Self, Error>
[src]

Splits ArrayString in two if at is smaller than self.len().

Returns Utf8 if at does not lie at a valid utf-8 char boundary and OutOfBounds if it's out of bounds

let mut s = SmallString::try_from_str("AB🤔CD")?;
assert_eq!(s.split_off(6)?.as_str(), "CD");
assert_eq!(s.as_str(), "AB🤔");
assert_eq!(s.split_off(20), Err(Error::OutOfBounds));
assert_eq!(s.split_off(4), Err(Error::Utf8));

pub fn clear(&mut self)
[src]

Empties ArrayString

let mut s = SmallString::try_from_str("ABCD")?;
assert!(!s.is_empty());
s.clear();
assert!(s.is_empty());

pub fn drain<R>(&mut self, range: R) -> Result<Drain<SIZE>, Error> where
    R: RangeBounds<u8>, 
[src]

Creates a draining iterator that removes the specified range in the ArrayString and yields the removed chars.

Note: The element range is removed even if the iterator is not consumed until the end.

let mut s = SmallString::try_from_str("ABCD🤔")?;
assert_eq!(s.drain(..3)?.collect::<Vec<_>>(), vec!['A', 'B', 'C']);
assert_eq!(s.as_str(), "D🤔");

assert_eq!(s.drain(3..), Err(Error::Utf8));
assert_eq!(s.drain(10..), Err(Error::OutOfBounds));

pub fn replace_range<S, R>(&mut self, r: R, with: S) -> Result<(), Error> where
    S: AsRef<str>,
    R: RangeBounds<u8>, 
[src]

Removes the specified range of the ArrayString, and replaces it with the given string. The given string doesn't need to have the same length as the range.

let mut s = SmallString::try_from_str("ABCD🤔")?;
s.replace_range(2..4, "EFGHI")?;
assert_eq!(s.as_str(), "ABEFGHI🤔");

assert_eq!(s.replace_range(9.., "J"), Err(Error::Utf8));
assert_eq!(s.replace_range(..90, "K"), Err(Error::OutOfBounds));
assert_eq!(s.replace_range(0..1, "0".repeat(SmallString::capacity().into())),
           Err(Error::OutOfBounds));

Trait Implementations

impl<'a, SIZE> From<&'a str> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl From<ArrayString<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B1>, B1>, B1>>> for CacheString
[src]

impl<SIZE: Capacity> Eq for ArrayString<SIZE>
[src]

impl<SIZE> Extend<char> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<'a, SIZE> Extend<&'a char> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<'a, SIZE> Extend<&'a str> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE> PartialOrd<ArrayString<SIZE>> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

#[must_use]
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

#[must_use]
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

#[must_use]
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

#[must_use]
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<SIZE> AsMut<str> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE: Capacity + Copy> Copy for ArrayString<SIZE> where
    SIZE::Array: Copy
[src]

impl<SIZE> Default for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<'a, 'b, SIZE> PartialEq<str> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<SIZE> PartialEq<ArrayString<SIZE>> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<SIZE> AsRef<str> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE> AsRef<[u8]> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE: Clone + Capacity> Clone for ArrayString<SIZE> where
    SIZE::Array: Clone
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<SIZE> Ord for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

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<SIZE> Debug for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE> Display for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE> Write for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

fn write_char(&mut self, c: char) -> Result<(), Error>
1.1.0
[src]

Writes a [char] into this writer, returning whether the write succeeded. Read more

fn write_fmt(&mut self, args: Arguments) -> Result<(), Error>
1.0.0
[src]

Glue for usage of the [write!] macro with implementors of this trait. Read more

impl<SIZE> DerefMut for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE> Deref for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

type Target = str

The resulting type after dereferencing.

impl<SIZE> Hash for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

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

impl<'a, SIZE> Add<&'a str> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

type Output = Self

The resulting type after applying the + operator.

impl<SIZE> Index<RangeFrom<u8>> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

type Output = str

The returned type after indexing.

impl<SIZE> Index<RangeTo<u8>> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

type Output = str

The returned type after indexing.

impl<SIZE> Index<RangeFull> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

type Output = str

The returned type after indexing.

impl<SIZE> Index<Range<u8>> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

type Output = str

The returned type after indexing.

impl<SIZE> Index<RangeToInclusive<u8>> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

type Output = str

The returned type after indexing.

impl<SIZE> Index<RangeInclusive<u8>> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

type Output = str

The returned type after indexing.

impl<SIZE> IndexMut<RangeFrom<u8>> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE> IndexMut<RangeTo<u8>> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE> IndexMut<RangeFull> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE> IndexMut<Range<u8>> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE> IndexMut<RangeToInclusive<u8>> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE> IndexMut<RangeInclusive<u8>> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE> FromIterator<char> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<'a, SIZE> FromIterator<&'a str> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE> FromStr for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

type Err = OutOfBounds

The associated error which can be returned from parsing.

impl<SIZE> Borrow<str> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE> BorrowMut<str> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<SIZE, ST, DB> Queryable<ST, DB> for ArrayString<SIZE> where
    SIZE: Capacity,
    DB: Backend,
    *const str: FromSql<ST, DB>, 
[src]

type Row = Self

The Rust type you'd like to map from. Read more

impl<SIZE: Capacity, QS> SelectableExpression<QS> for ArrayString<SIZE>
[src]

impl<SIZE: Capacity, QS> AppearsOnTable<QS> for ArrayString<SIZE>
[src]

impl<SIZE: Capacity> Expression for ArrayString<SIZE>
[src]

type SqlType = VarChar

The type that this expression represents in SQL

impl<SIZE, DB> ToSql<Text, DB> for ArrayString<SIZE> where
    SIZE: Capacity,
    DB: Backend
[src]

impl<SIZE, DB> QueryFragment<DB> for ArrayString<SIZE> where
    SIZE: Capacity,
    DB: Backend + HasSqlType<VarChar>, 
[src]

fn to_sql(&self, out: &mut <DB as Backend>::QueryBuilder) -> Result<(), Error>
[src]

Converts this QueryFragment to its SQL representation. Read more

fn collect_binds(
    &self,
    out: &mut <DB as Backend>::BindCollector,
    metadata_lookup: &<DB as TypeMetadata>::MetadataLookup
) -> Result<(), Error>
[src]

Serializes all bind parameters in this query. Read more

fn is_safe_to_cache_prepared(&self) -> Result<bool, Error>
[src]

Is this query safe to store in the prepared statement cache? Read more

impl<SIZE: Capacity> NonAggregate for ArrayString<SIZE>
[src]

impl<SIZE, ST, DB> FromSql<ST, DB> for ArrayString<SIZE> where
    SIZE: Capacity,
    DB: Backend,
    *const str: FromSql<ST, DB>, 
[src]

impl<SIZE, ST, DB> FromSqlRow<ST, DB> for ArrayString<SIZE> where
    SIZE: Capacity,
    DB: Backend,
    *const str: FromSql<ST, DB>, 
[src]

impl<SIZE> Serialize for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

impl<'a, SIZE> Deserialize<'a> for ArrayString<SIZE> where
    SIZE: Capacity, 
[src]

Auto Trait Implementations

impl<SIZE> Send for ArrayString<SIZE> where
    <SIZE as Capacity>::Array: Send

impl<SIZE> Sync for ArrayString<SIZE> where
    <SIZE as Capacity>::Array: Sync

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

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

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T
[src]

type Output = T

Should always be Self

impl<T> IntoSql for T
[src]

fn into_sql<T>(self) -> Self::Expression where
    Self: AsExpression<T>, 
[src]

Convert self to an expression for Diesel's query builder. Read more

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
    &'a Self: AsExpression<T>, 
[src]

Convert &self to an expression for Diesel's query builder. Read more

impl<QS, T, DB> BoxableExpression for T where
    DB: Backend,
    T: Expression + SelectableExpression<QS> + NonAggregate + QueryFragment<DB>, 
[src]

impl<T> NullableExpressionMethods for T where
    T: Expression
[src]

fn nullable(self) -> Nullable<Self>
[src]

Converts this potentially non-null expression into one which is treated as nullable. This method has no impact on the generated SQL, and is only used to allow certain comparisons that would otherwise fail to compile. Read more

impl<T> TextExpressionMethods for T where
    T: Expression,
    <T as Expression>::SqlType: TextOrNullableText, 
[src]

fn concat<T>(
    self,
    other: T
) -> Concat<Self, <T as AsExpression<Self::SqlType>>::Expression> where
    T: AsExpression<Self::SqlType>, 
[src]

Concatenates two strings using the || operator. Read more

fn like<T>(
    self,
    other: T
) -> Like<Self, <T as AsExpression<Self::SqlType>>::Expression> where
    T: AsExpression<Self::SqlType>, 
[src]

Returns a SQL LIKE expression Read more

fn not_like<T>(
    self,
    other: T
) -> NotLike<Self, <T as AsExpression<Self::SqlType>>::Expression> where
    T: AsExpression<Self::SqlType>, 
[src]

Returns a SQL NOT LIKE expression Read more

impl<T> ExpressionMethods for T where
    T: Expression,
    <T as Expression>::SqlType: SingleValue
[src]

fn eq<T>(
    self,
    other: T
) -> Eq<Self, <T as AsExpression<Self::SqlType>>::Expression> where
    T: AsExpression<Self::SqlType>, 
[src]

Creates a SQL = expression. Read more

fn ne<T>(
    self,
    other: T
) -> NotEq<Self, <T as AsExpression<Self::SqlType>>::Expression> where
    T: AsExpression<Self::SqlType>, 
[src]

Creates a SQL != expression. Read more

fn eq_any<T>(
    self,
    values: T
) -> In<Self, <T as AsInExpression<Self::SqlType>>::InExpression> where
    T: AsInExpression<Self::SqlType>, 
[src]

Creates a SQL IN statement. Read more

fn ne_any<T>(
    self,
    values: T
) -> NotIn<Self, <T as AsInExpression<Self::SqlType>>::InExpression> where
    T: AsInExpression<Self::SqlType>, 
[src]

Deprecated since 1.2.0:

use ne_all instead

Deprecated alias for ne_all Read more

fn ne_all<T>(
    self,
    values: T
) -> NotIn<Self, <T as AsInExpression<Self::SqlType>>::InExpression> where
    T: AsInExpression<Self::SqlType>, 
[src]

Creates a SQL NOT IN statement. Read more

fn is_null(self) -> IsNull<Self>
[src]

Creates a SQL IS NULL expression. Read more

fn is_not_null(self) -> IsNotNull<Self>
[src]

Creates a SQL IS NOT NULL expression. Read more

fn gt<T>(
    self,
    other: T
) -> Gt<Self, <T as AsExpression<Self::SqlType>>::Expression> where
    T: AsExpression<Self::SqlType>, 
[src]

Creates a SQL > expression. Read more

fn ge<T>(
    self,
    other: T
) -> GtEq<Self, <T as AsExpression<Self::SqlType>>::Expression> where
    T: AsExpression<Self::SqlType>, 
[src]

Creates a SQL >= expression. Read more

fn lt<T>(
    self,
    other: T
) -> Lt<Self, <T as AsExpression<Self::SqlType>>::Expression> where
    T: AsExpression<Self::SqlType>, 
[src]

Creates a SQL < expression. Read more

fn le<T>(
    self,
    other: T
) -> LtEq<Self, <T as AsExpression<Self::SqlType>>::Expression> where
    T: AsExpression<Self::SqlType>, 
[src]

Creates a SQL <= expression. Read more

fn between<T, U>(
    self,
    lower: T,
    upper: U
) -> Between<Self, And<<T as AsExpression<Self::SqlType>>::Expression, <U as AsExpression<Self::SqlType>>::Expression>> where
    T: AsExpression<Self::SqlType>,
    U: AsExpression<Self::SqlType>, 
[src]

Creates a SQL BETWEEN expression using the given lower and upper bounds. Read more

fn not_between<T, U>(
    self,
    lower: T,
    upper: U
) -> NotBetween<Self, And<<T as AsExpression<Self::SqlType>>::Expression, <U as AsExpression<Self::SqlType>>::Expression>> where
    T: AsExpression<Self::SqlType>,
    U: AsExpression<Self::SqlType>, 
[src]

Creates a SQL NOT BETWEEN expression using the given lower and upper bounds. Read more

fn desc(self) -> Desc<Self>
[src]

Creates a SQL DESC expression, representing this expression in descending order. Read more

fn asc(self) -> Asc<Self>
[src]

Creates a SQL ASC expression, representing this expression in ascending order. Read more

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]