pub struct TokenList { /* private fields */ }Expand description
A list of TokenComponents parsed from a comma-separated string.
§Examples
use dynomite::conf::TokenList;
let t = TokenList::parse("0,1,2").unwrap();
assert_eq!(t.len(), 3);
assert_eq!(t.to_string(), "0,1,2");Implementations§
Source§impl TokenList
impl TokenList
Sourcepub fn parse(raw: &str) -> Result<Self, ConfError>
pub fn parse(raw: &str) -> Result<Self, ConfError>
Parse a comma-separated list. Leading or trailing whitespace inside each component is rejected.
§Examples
use dynomite::conf::TokenList;
assert_eq!(TokenList::parse("-7,0,9").unwrap().len(), 3);
assert!(TokenList::parse("").is_err());
assert!(TokenList::parse("1,,2").is_err());Sourcepub fn components(&self) -> &[TokenComponent]
pub fn components(&self) -> &[TokenComponent]
Borrow the parsed components.
§Examples
use dynomite::conf::TokenList;
let t = TokenList::parse("1,2,3").unwrap();
assert_eq!(t.components().len(), 3);Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of components in the list.
§Examples
use dynomite::conf::TokenList;
assert_eq!(TokenList::parse("5").unwrap().len(), 1);Trait Implementations§
Source§impl<'de> Deserialize<'de> for TokenList
impl<'de> Deserialize<'de> for TokenList
Source§fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for TokenList
impl StructuralPartialEq for TokenList
Auto Trait Implementations§
impl Freeze for TokenList
impl RefUnwindSafe for TokenList
impl Send for TokenList
impl Sync for TokenList
impl Unpin for TokenList
impl UnsafeUnpin for TokenList
impl UnwindSafe for TokenList
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.