Struct pschema_rs::shape::shex::ShapeComposite
source · pub struct ShapeComposite { /* private fields */ }Expand description
The ShapeComposite struct represents a composite shape made up of multiple
Shape objects, with a label assigned to it.
Properties:
label: Thelabelproperty is au8value that represents a label or identifier for theShapeCompositeobject.shapes:shapesis a vector ofShapeobjects that are part of theShapeComposite. It can hold any number ofShapeobjects and allows for easy manipulation of the composite as a whole.
Implementations§
source§impl ShapeComposite
impl ShapeComposite
This is an implementation of the ShapeComposite struct, which defines two
methods: new and get_shapes.
sourcepub fn new(label: u8, shapes: Vec<Shape>) -> Self
pub fn new(label: u8, shapes: Vec<Shape>) -> Self
This is a constructor function that creates a new instance of a struct with a label and a vector of shapes.
Arguments:
label: Thelabelparameter is of typeu8and represents a label or identifier for the group of shapes.shapes:shapesis a vector ofShapeobjects. It is a parameter of thenewfunction and is used to initialize theshapesfield of the struct. Theshapesfield is a vector that holds all the shapes that belong to the object.
Returns:
The new function is returning an instance of the struct that it is defined in.
The struct has two fields: label of type u8 and shapes of type
Vec<Shape>. The Self keyword refers to the struct itself, so the function is
returning an instance of that struct with the specified label and shapes.
sourcepub fn get_shapes(&self) -> Vec<Shape>
pub fn get_shapes(&self) -> Vec<Shape>
This function returns a vector of shapes.
Returns:
A vector of Shape objects is being returned. The get_shapes function is a
method of some struct or class that has a field called shapes, which is a
collection of Shape objects. The to_vec method is called on this collection
to create a new vector containing the same Shape objects. This new vector is
then returned by the function.
Trait Implementations§
source§impl Clone for ShapeComposite
impl Clone for ShapeComposite
source§fn clone(&self) -> ShapeComposite
fn clone(&self) -> ShapeComposite
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ShapeComposite
impl Debug for ShapeComposite
source§impl From<ShapeComposite> for Shape
impl From<ShapeComposite> for Shape
This is an implementation of the From trait for the ShapeComposite struct.
The From trait is a Rust language feature that allows for automatic conversion
between types. In this case, it allows a ShapeComposite object to be converted
into a Shape enum variant.
source§fn from(value: ShapeComposite) -> Self
fn from(value: ShapeComposite) -> Self
source§impl PartialEq<ShapeComposite> for ShapeComposite
impl PartialEq<ShapeComposite> for ShapeComposite
source§fn eq(&self, other: &ShapeComposite) -> bool
fn eq(&self, other: &ShapeComposite) -> bool
self and other values to be equal, and is used
by ==.