Context

Struct Context 

Source
pub struct Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,
{ /* private fields */ }

Implementations§

Source§

impl<D, S, T, ST, SYM, VS, VT> Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,

Source

pub fn with_capacity(id: ContextId, name: &str, capacity: usize) -> Self

Creates a new context with the given node capacity.

Source

pub fn name(&self) -> &str

Returns the name of the context.

Source

pub fn set_name(&mut self, new_name: String)

Sets the name of the context.

Source

pub fn get_node_index_by_id(&self, id: ContextoidId) -> Option<usize>

Returns the internal graph index for a given ContextoidId. This is useful for mapping external IDs to internal graph indices.

Trait Implementations§

Source§

impl<D, S, T, ST, SYM, VS, VT> Clone for Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<D, S, T, ST, SYM, VS, VT> ContextuableGraph<D, S, T, ST, SYM, VS, VT> for Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,

Source§

fn contains_node(&self, index: usize) -> bool

Returns only true if the context contains the contextoid with the given index.

Source§

fn get_node( &self, index: usize, ) -> Option<&Contextoid<D, S, T, ST, SYM, VS, VT>>

Returns a reference to the contextoid with the given index. If the context does not contain the contextoid, it will return None.

Source§

fn add_edge( &mut self, a: usize, b: usize, weight: RelationKind, ) -> Result<(), ContextIndexError>

Adds a new weighted edge between two nodes. Returns either Ok after success, or ContextIndexError if any of the nodes are not in the context.

Source§

fn contains_edge(&self, a: usize, b: usize) -> bool

Returns only true if the context contains the edge between the two nodes. If the context does not contain the edge or any of the nodes it will return false. You may want to call contains_node first to ascertain that the nodes are in the context.

Source§

fn remove_edge(&mut self, a: usize, b: usize) -> Result<(), ContextIndexError>

Removes an edge between two nodes. Returns either Ok after success, or ContextIndexError if any of the nodes are not in the context.

Source§

fn size(&self) -> usize

Returns the number of nodes in the context. Alias for node_count().

Source§

fn is_empty(&self) -> bool

Returns true if the context contains no nodes.

Source§

fn number_of_nodes(&self) -> usize

Returns the number of nodes in the context.

Source§

fn number_of_edges(&self) -> usize

Returns the number of edges in the context.

Source§

fn add_node( &mut self, value: Contextoid<D, S, T, ST, SYM, VS, VT>, ) -> Result<usize, ContextIndexError>

Source§

fn remove_node( &mut self, node_id: ContextoidId, ) -> Result<(), ContextIndexError>

Source§

fn update_node( &mut self, node_id: ContextoidId, new_node: Contextoid<D, S, T, ST, SYM, VS, VT>, ) -> Result<(), ContextIndexError>

Source§

impl<D, S, T, ST, SYM, VS, VT> CurrentDataIndex for Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,

Source§

fn get_current_data_index(&self) -> Option<&usize>

Get the current data index. Read more
Source§

fn set_current_data_index(&mut self, index: usize)

Set the current data index. Read more
Source§

impl<D, S, T, ST, SYM, VS, VT> CurrentTimeIndex for Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,

Source§

fn get_current_year_index(&self) -> Option<&usize>

Get the current year index. Read more
Source§

fn get_current_month_index(&self) -> Option<&usize>

Get the current month index. Read more
Source§

fn get_current_week_index(&self) -> Option<&usize>

Get the current week index. Read more
Source§

fn get_current_day_index(&self) -> Option<&usize>

Get the current day index. Read more
Source§

fn get_current_hour_index(&self) -> Option<&usize>

Get the current hour index. Read more
Source§

fn get_current_minute_index(&self) -> Option<&usize>

Get the current minute index. Read more
Source§

fn set_current_year_index(&mut self, index: usize)

Set the current year index. Read more
Source§

fn set_current_month_index(&mut self, index: usize)

Set the current month index. Read more
Source§

fn set_current_week_index(&mut self, index: usize)

Set the current week index. Read more
Source§

fn set_current_day_index(&mut self, index: usize)

Set the current day index. Read more
Source§

fn set_current_hour_index(&mut self, index: usize)

Set the current hour index. Read more
Source§

fn set_current_minute_index(&mut self, index: usize)

Set the current minute index. Read more
Source§

impl<D, S, T, ST, SYM, VS, VT> DataIndexable for Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,

Source§

fn get_data_index(&self, key: &usize, current: bool) -> Option<&usize>

Gets the data index for the provided key from either the current or previous index map, depending on the value of current. Read more
Source§

fn set_data_index(&mut self, key: usize, index: usize, current: bool)

Sets the data index for the provided key in either the current or previous index map, depending on the value of current. Read more
Source§

impl<D, S, T, ST, SYM, VS, VT> Debug for Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<D, S, T, ST, SYM, VS, VT> Display for Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<D, S, T, ST, SYM, VS, VT> ExtendableContextuableGraph<D, S, T, ST, SYM, VS, VT> for Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,

Source§

fn extra_ctx_add_new(&mut self, capacity: usize, default: bool) -> u64

Creates a new, empty “extra” context and adds it to the collection. Read more
Source§

fn extra_ctx_add_new_with_id( &mut self, id: u64, capacity: usize, default: bool, ) -> Result<(), ContextIndexError>

Creates a new extra context with a specific, user-provided ID. Read more
Source§

fn extra_ctx_check_exists(&self, idx: u64) -> bool

Checks if an extra context with the given ID exists. Read more
Source§

fn extra_ctx_get_current_id(&self) -> u64

Gets the ID of the currently active extra context. Read more
Source§

fn extra_ctx_set_current_id( &mut self, idx: u64, ) -> Result<(), ContextIndexError>

Sets the active extra context to the one identified by the given ID. Read more
Source§

fn extra_ctx_unset_current_id(&mut self) -> Result<(), ContextIndexError>

Unsets the currently active extra context. Read more
Source§

fn extra_ctx_add_node( &mut self, value: Contextoid<D, S, T, ST, SYM, VS, VT>, ) -> Result<usize, ContextIndexError>

Adds a Contextoid node to the currently active extra context. Read more
Source§

fn extra_ctx_contains_node(&self, index: usize) -> bool

Checks if a node with the given index exists in the currently active extra context. Read more
Source§

fn extra_ctx_get_node( &self, index: usize, ) -> Result<&Contextoid<D, S, T, ST, SYM, VS, VT>, ContextIndexError>

Retrieves an immutable reference to a Contextoid from the currently active extra context. Read more
Source§

fn extra_ctx_remove_node( &mut self, index: usize, ) -> Result<(), ContextIndexError>

Removes a node by its index from the currently active extra context. Read more
Source§

fn extra_ctx_add_edge( &mut self, a: usize, b: usize, weight: RelationKind, ) -> Result<(), ContextIndexError>

Adds a directed edge between two nodes in the currently active extra context. Read more
Source§

fn extra_ctx_contains_edge(&self, a: usize, b: usize) -> bool

Checks if a directed edge exists between two nodes in the currently active extra context. Read more
Source§

fn extra_ctx_remove_edge( &mut self, a: usize, b: usize, ) -> Result<(), ContextIndexError>

Removes a directed edge between two nodes in the currently active extra context. Read more
Source§

fn extra_ctx_size(&self) -> Result<usize, ContextIndexError>

Returns the number of nodes in the currently active extra context’s graph. Read more
Source§

fn extra_ctx_is_empty(&self) -> Result<bool, ContextIndexError>

Checks if the currently active extra context’s graph is empty (contains no nodes). Read more
Source§

fn extra_ctx_node_count(&self) -> Result<usize, ContextIndexError>

Returns the total number of nodes in the currently active extra context’s graph. Read more
Source§

fn extra_ctx_edge_count(&self) -> Result<usize, ContextIndexError>

Returns the total number of edges in the currently active extra context’s graph. Read more
Source§

impl<D, S, T, ST, SYM, VS, VT> Identifiable for Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,

Source§

fn id(&self) -> u64

Returns the id of the context.

Source§

impl<D, S, T, ST, SYM, VS, VT> PreviousDataIndex for Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,

Source§

fn get_previous_data_index(&self) -> Option<&usize>

Get the previous data index. Read more
Source§

fn set_previous_data_index(&mut self, index: usize)

Set the current previous index. Read more
Source§

impl<D, S, T, ST, SYM, VS, VT> PreviousTimeIndex for Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,

Source§

fn get_previous_year_index(&self) -> Option<&usize>

Returns the previous year index, if it exists. Read more
Source§

fn get_previous_month_index(&self) -> Option<&usize>

Returns the previous month index, if it exists. Read more
Source§

fn get_previous_week_index(&self) -> Option<&usize>

Returns the previous week index, if it exists. Read more
Source§

fn get_previous_day_index(&self) -> Option<&usize>

Returns the previous day index, if it exists. Read more
Source§

fn get_previous_hour_index(&self) -> Option<&usize>

Returns the previous hour index, if it exists. Read more
Source§

fn get_previous_minute_index(&self) -> Option<&usize>

Returns the previous minute index, if it exists. Read more
Source§

fn set_previous_year_index(&mut self, index: usize)

Sets the previous year index. Read more
Source§

fn set_previous_month_index(&mut self, index: usize)

Sets the previous month index. Read more
Source§

fn set_previous_week_index(&mut self, index: usize)

Sets the previous week index. Read more
Source§

fn set_previous_day_index(&mut self, index: usize)

Sets the previous day index. Read more
Source§

fn set_previous_hour_index(&mut self, index: usize)

Sets the previous hour index. Read more
Source§

fn set_previous_minute_index(&mut self, index: usize)

Sets the previous minute index. Read more
Source§

impl<D, S, T, ST, SYM, VS, VT> TimeIndexable for Context<D, S, T, ST, SYM, VS, VT>
where D: Datable + Clone, S: Spatial<VS> + Clone, T: Temporal<VT> + Clone, ST: SpaceTemporal<VS, VT> + Clone, SYM: Symbolic + Clone, VS: Clone, VT: Clone,

Source§

fn get_time_index(&self, key: &usize, current: bool) -> Option<&usize>

Gets the time index for the provided key from either the current or previous index map, depending on the value of current. Read more
Source§

fn set_time_index(&mut self, key: usize, index: usize, current: bool)

Sets the time index for the provided key in either the current or previous index map, depending on the value of current. Read more

Auto Trait Implementations§

§

impl<D, S, T, ST, SYM, VS, VT> Freeze for Context<D, S, T, ST, SYM, VS, VT>

§

impl<D, S, T, ST, SYM, VS, VT> RefUnwindSafe for Context<D, S, T, ST, SYM, VS, VT>

§

impl<D, S, T, ST, SYM, VS, VT> Send for Context<D, S, T, ST, SYM, VS, VT>
where D: Send, T: Send, S: Send, ST: Send, SYM: Send, VS: Send, VT: Send,

§

impl<D, S, T, ST, SYM, VS, VT> Sync for Context<D, S, T, ST, SYM, VS, VT>
where D: Sync, T: Sync, S: Sync, ST: Sync, SYM: Sync, VS: Sync, VT: Sync,

§

impl<D, S, T, ST, SYM, VS, VT> Unpin for Context<D, S, T, ST, SYM, VS, VT>
where D: Unpin, T: Unpin, S: Unpin, ST: Unpin, SYM: Unpin, VS: Unpin, VT: Unpin,

§

impl<D, S, T, ST, SYM, VS, VT> UnwindSafe for Context<D, S, T, ST, SYM, VS, VT>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.