pub struct Stickfigure {
pub version: i32,
pub build: i32,
pub scale: f32,
pub color: Color,
pub nodes: Graph<Rc<RefCell<Node>>, ()>,
pub polyfills: Vec<Rc<RefCell<Polyfill>>>,
/* private fields */
}
Fields§
§version: i32
§build: i32
§scale: f32
§color: Color
§nodes: Graph<Rc<RefCell<Node>>, ()>
§polyfills: Vec<Rc<RefCell<Polyfill>>>
Implementations§
Source§impl Stickfigure
Public Methods
impl Stickfigure
Public Methods
Sourcepub fn from_version_and_build(
version: i32,
build: i32,
) -> Result<Self, LibraryError>
pub fn from_version_and_build( version: i32, build: i32, ) -> Result<Self, LibraryError>
Creates a new, empty Stickfigure
, set to the specified version and build.
pub fn to_serializable(&self) -> SerializableStickfigure
pub fn set_is_node_limit_enabled( &mut self, is_enabled: bool, agree: IWillNotAbuseUnlimitedNodes, )
Sourcepub fn from_bytes(reader: &mut impl Read) -> Result<Self, LibraryError>
pub fn from_bytes(reader: &mut impl Read) -> Result<Self, LibraryError>
Creates a new Stickfigure
from raw bytes of a .nodes
file.
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>, LibraryError>
pub fn to_bytes(&self) -> Result<Vec<u8>, LibraryError>
Get raw bytes of a .nodes
file from an existing Stickfigure
.
Sourcepub fn add_node(
&mut self,
node: Node,
parent_draw_index: DrawOrderIndex,
) -> Result<DrawOrderIndex, StickfigureError>
pub fn add_node( &mut self, node: Node, parent_draw_index: DrawOrderIndex, ) -> Result<DrawOrderIndex, StickfigureError>
pub fn add_node_at_index( &mut self, node: Node, parent_draw_index: DrawOrderIndex, draw_index: DrawOrderIndex, ) -> Result<DrawOrderIndex, StickfigureError>
pub fn change_draw_index( &mut self, draw_index: DrawOrderIndex, new_draw_index: DrawOrderIndex, ) -> Result<(), StickfigureError>
Sourcepub fn get_parent(&self, draw_index: DrawOrderIndex) -> Option<DrawOrderIndex>
pub fn get_parent(&self, draw_index: DrawOrderIndex) -> Option<DrawOrderIndex>
Get the DrawOrderIndex
of the direct parent of the Node
at the specified DrawOrderIndex
.
Sourcepub fn get_children(
&self,
parent_draw_index: DrawOrderIndex,
) -> Vec<DrawOrderIndex>
pub fn get_children( &self, parent_draw_index: DrawOrderIndex, ) -> Vec<DrawOrderIndex>
Get a Vec<DrawOrderIndex>
containing all DrawOrderIndex
s of Node
s that are direct children of the Node
at the specified DrawOrderIndex
.
pub fn get_children_recursive( &self, draw_index: DrawOrderIndex, ) -> Vec<DrawOrderIndex>
pub fn get_parents_recursive( &self, draw_index: DrawOrderIndex, ) -> Vec<DrawOrderIndex>
pub fn get_all_node_indices(&self) -> Vec<DrawOrderIndex>
Sourcepub fn get_siblings(&self, draw_index: DrawOrderIndex) -> Vec<DrawOrderIndex>
pub fn get_siblings(&self, draw_index: DrawOrderIndex) -> Vec<DrawOrderIndex>
pub fn get_nodes_with_property<F>(&self, predicate: F) -> Vec<DrawOrderIndex>
pub fn update_nodes_with_property<F>(&mut self, predicate: F, updater: F)
pub fn remove_node( &mut self, draw_index: DrawOrderIndex, ) -> Result<(), StickfigureError>
pub fn add_polyfill(&mut self, polyfill: Polyfill) -> DrawOrderIndex
pub fn get_polyfill( &self, draw_index: DrawOrderIndex, ) -> Option<Rc<RefCell<Polyfill>>>
pub fn remove_polyfill( &mut self, anchor_draw_order: DrawOrderIndex, ) -> Result<(), StickfigureError>
Sourcepub fn all_draw_indices_exist(&self, indices: &[DrawOrderIndex]) -> bool
pub fn all_draw_indices_exist(&self, indices: &[DrawOrderIndex]) -> bool
Returns true if all provided DrawOrderIndices exist in the node_index_map.
Sourcepub fn draw_index_exists(&self, draw_index: DrawOrderIndex) -> bool
pub fn draw_index_exists(&self, draw_index: DrawOrderIndex) -> bool
Returns true if provided DrawOrderIndex exists in the node_index_map.
pub fn draw_index_is_polyfill_anchor(&self, draw_index: DrawOrderIndex) -> bool
Sourcepub fn missing_draw_indices(
&self,
indices: &[DrawOrderIndex],
) -> Vec<DrawOrderIndex>
pub fn missing_draw_indices( &self, indices: &[DrawOrderIndex], ) -> Vec<DrawOrderIndex>
Returns a Vec of DrawOrderIndices that do not exist in node_index_map.
Trait Implementations§
Source§impl Clone for Stickfigure
impl Clone for Stickfigure
Source§fn clone(&self) -> Stickfigure
fn clone(&self) -> Stickfigure
Returns a copy of the value. Read more
1.0.0 · 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 Stickfigure
impl Debug for Stickfigure
Auto Trait Implementations§
impl Freeze for Stickfigure
impl !RefUnwindSafe for Stickfigure
impl !Send for Stickfigure
impl !Sync for Stickfigure
impl Unpin for Stickfigure
impl !UnwindSafe for Stickfigure
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