pub struct NonEmptyStringList(/* private fields */);Expand description
A Part 21 LIST[1:?] OF STRING — guaranteed to hold at least one element.
STEP’s FILE_DESCRIPTION.description, FILE_NAME.author, and
FILE_NAME.organization fields are typed LIST[1:?] OF STRING; an empty
list is a spec violation. Encoding that constraint at the type level
prevents construction of spec-violating FileHeader values: any attempt
to build a NonEmptyStringList from an empty Vec<String> returns
None rather than an invalid value.
STEP convention for “no meaningful content” is a single-element list
holding "", which is what NonEmptyStringList::default produces.
Implementations§
Source§impl NonEmptyStringList
impl NonEmptyStringList
Sourcepub fn try_from_vec(v: Vec<String>) -> Option<Self>
pub fn try_from_vec(v: Vec<String>) -> Option<Self>
Lift a Vec<String> to NonEmptyStringList; returns None for an
empty input.
pub fn as_slice(&self) -> &[String]
Sourcepub fn iter(&self) -> Iter<'_, String>
pub fn iter(&self) -> Iter<'_, String>
Inherent iterator (idiomatic companion to IntoIterator for &Self).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for NonEmptyStringList
impl Clone for NonEmptyStringList
Source§fn clone(&self) -> NonEmptyStringList
fn clone(&self) -> NonEmptyStringList
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NonEmptyStringList
impl Debug for NonEmptyStringList
Source§impl Default for NonEmptyStringList
impl Default for NonEmptyStringList
impl Eq for NonEmptyStringList
Source§impl<'a> IntoIterator for &'a NonEmptyStringList
impl<'a> IntoIterator for &'a NonEmptyStringList
Source§impl PartialEq for NonEmptyStringList
impl PartialEq for NonEmptyStringList
Source§fn eq(&self, other: &NonEmptyStringList) -> bool
fn eq(&self, other: &NonEmptyStringList) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for NonEmptyStringList
Auto Trait Implementations§
impl Freeze for NonEmptyStringList
impl RefUnwindSafe for NonEmptyStringList
impl Send for NonEmptyStringList
impl Sync for NonEmptyStringList
impl Unpin for NonEmptyStringList
impl UnsafeUnpin for NonEmptyStringList
impl UnwindSafe for NonEmptyStringList
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