Skip to main content

IsGeometryTable

Trait IsGeometryTable 

Source
pub trait IsGeometryTable {
    type Key: IsGeometryKey;
    type Item: GeometricPrimitive;

    // Required methods
    fn get(&self, key: &Self::Key) -> Option<Self::Item>;
    fn insert(
        &mut self,
        key: Self::Key,
        value: Self::Item,
    ) -> Result<(), ErrorsJSL>;
    fn remove(&mut self, key: &Self::Key) -> Option<Self::Item>;
    fn contains_key(&self, key: &Self::Key) -> bool;
    fn size(&self) -> usize;
    fn union(&self, other: &Self) -> Self
       where Self: Sized;
    fn intersection(&self, other: &Self) -> Self
       where Self: Sized;
    fn iter(&self) -> Box<dyn Iterator<Item = (Self::Key, Self::Item)> + '_>;
    fn to_file(&self, path: &str) -> Result<(), ErrorsJSL>;
    fn from_file(path: &str) -> Result<Self, ErrorsJSL>
       where Self: Sized;
}
Expand description

Abstraction over a keyed mutable collection of geometry primitives.

Required Associated Types§

Source

type Key: IsGeometryKey

Stable key used to address items in the table.

Source

type Item: GeometricPrimitive

Item stored by the table.

Required Methods§

Source

fn get(&self, key: &Self::Key) -> Option<Self::Item>

Returns the item stored at key, if present.

Source

fn insert(&mut self, key: Self::Key, value: Self::Item) -> Result<(), ErrorsJSL>

Inserts or replaces the item stored at key.

Source

fn remove(&mut self, key: &Self::Key) -> Option<Self::Item>

Removes and returns the item stored at key, if present.

Source

fn contains_key(&self, key: &Self::Key) -> bool

Returns true if key exists in the table.

Source

fn size(&self) -> usize

Returns the number of items held by the table.

Source

fn union(&self, other: &Self) -> Self
where Self: Sized,

Computes the union of two tables.

Source

fn intersection(&self, other: &Self) -> Self
where Self: Sized,

Computes the intersection of two tables.

Source

fn iter(&self) -> Box<dyn Iterator<Item = (Self::Key, Self::Item)> + '_>

Iterates immutably over key/value pairs in the table.

Source

fn to_file(&self, path: &str) -> Result<(), ErrorsJSL>

Serializes the table to a file (as JSON for the library’s tables; requires the serde feature, and returns an error without it).

Source

fn from_file(path: &str) -> Result<Self, ErrorsJSL>
where Self: Sized,

Loads a table instance from a file.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§