pub struct ShapeSet {
newtype: bool,
named: bool,
tuple: bool,
unit: bool,
}
Expand description
Fields§
§newtype: bool
§named: bool
§tuple: bool
§unit: bool
Implementations§
source§impl ShapeSet
impl ShapeSet
sourcepub fn new(items: impl IntoIterator<Item = Shape>) -> Self
pub fn new(items: impl IntoIterator<Item = Shape>) -> Self
Create a new ShapeSet
which includes the specified items.
§Exampe
let shape_set = ShapeSet::new(vec![Shape::Named, Shape::Newtype]);
assert!(shape_set.contains(&Shape::Newtype));
sourcepub fn insert_all(&mut self)
pub fn insert_all(&mut self)
sourcepub fn insert(&mut self, shape: Shape)
pub fn insert(&mut self, shape: Shape)
Insert a shape into the set, so that the set will match that shape
fn contains_shape(&self, shape: Shape) -> bool
sourcepub fn contains(&self, fields: &impl AsShape) -> bool
pub fn contains(&self, fields: &impl AsShape) -> bool
Check if a fields container’s shape is in this set.
sourcepub fn check(&self, fields: &impl AsShape) -> Result<()>
pub fn check(&self, fields: &impl AsShape) -> Result<()>
Check if a field container’s shape is in this set of shapes, and produce
an Error
if it does not.
fn to_vec(&self) -> Vec<Shape>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ShapeSet
impl RefUnwindSafe for ShapeSet
impl Send for ShapeSet
impl Sync for ShapeSet
impl Unpin for ShapeSet
impl UnwindSafe for ShapeSet
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)