Struct pschema_rs::shape::shex::Cardinality
source · pub struct Cardinality { /* private fields */ }Expand description
The Cardinality type represents the shape and bounds of a set or sequence.
Properties:
shape: Theshapeproperty is aShapeenum that represents the shape of the cardinality. It could be one of the following:min:minis a property of theCardinalitystruct that represents the minimum number of elements allowed in the associatedShape. It is of typeBound, which is likely an enum that can represent either a specific integer value or an unbounded value (e.g. `Bound::Finitemax:maxis a property of theCardinalitystruct that represents the maximum number of elements that can be contained within the shape defined by theshapeproperty. It is of typeBound, which is an enum that can either beFinite(usize)to represent a specific number
Implementations§
source§impl Cardinality
impl Cardinality
This is an implementation of the Cardinality struct. It defines two methods:
new and get_shape.
sourcepub fn new(shape: Shape, min: Bound, max: Bound) -> Self
pub fn new(shape: Shape, min: Bound, max: Bound) -> Self
This is a constructor function that creates a new instance of a struct with a given shape, minimum bound, and maximum bound.
Arguments:
shape: The shape parameter is of type Shape and represents the geometric shape of an object. It could be a circle, rectangle, triangle, or any other shape that can be defined mathematically.min:minis a parameter of typeBoundthat represents the minimum bounds of the shape. It is used in the constructor of a struct to create a new instance of the struct with the specified shape and minimum and maximum bounds.max:maxis a parameter of typeBoundthat represents the maximum bounds of the shape. It is used in thenewfunction to create a new instance of theSelfstruct.
Returns:
The new function is returning an instance of the struct that it is defined in.
The type of the returned value is Self, which in this case refers to the
struct that the new function is defined in.
Trait Implementations§
source§impl Clone for Cardinality
impl Clone for Cardinality
source§fn clone(&self) -> Cardinality
fn clone(&self) -> Cardinality
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for Cardinality
impl Debug for Cardinality
source§impl From<Cardinality> for Shape
impl From<Cardinality> for Shape
This implementation allows a Cardinality struct to be converted into a Shape
enum variant using the From trait. It creates a new Shape::Cardinality
variant with the Cardinality struct wrapped in a Box. This allows for more
flexibility in working with Shape objects, as a Cardinality can be treated
as a Shape in certain contexts.
source§fn from(value: Cardinality) -> Self
fn from(value: Cardinality) -> Self
source§impl PartialEq<Cardinality> for Cardinality
impl PartialEq<Cardinality> for Cardinality
source§fn eq(&self, other: &Cardinality) -> bool
fn eq(&self, other: &Cardinality) -> bool
self and other values to be equal, and is used
by ==.