ConfigObjectMap

Struct ConfigObjectMap 

Source
pub struct ConfigObjectMap<T: ConfigObject> { /* private fields */ }
Expand description

A map of objects implementing the ConfigObject trait.

This struct provides a container for storing and managing a collection of objects, each of which implements the ConfigObject trait. It uses a HashMap to maintain a mapping between object names and the objects themselves, facilitating efficient retrieval and management.

§Type Parameters

  • T - The type of the objects stored in the map. Must implement the ConfigObject and Clone traits.

§Fields

  • objects - A HashMap where keys are object names and values are Arc<T>.

Implementations§

Source§

impl<T: ConfigObject + Clone> ConfigObjectMap<T>

Source

pub fn iter_cloned(&self) -> impl Iterator<Item = T> + '_

Creates an iterator over cloned objects in the collection.

Source§

impl<T: ConfigObject> ConfigObjectMap<T>

Source

pub fn new() -> Self

Creates a new instance of ConfigObjectMap with default values.

Source

pub fn add(&mut self, object: T)

Adds an object to the collection using the object’s unique name as the key. The unique name is retrieved by calling the unique_name() method on the object.

Source

pub fn add_ref(&mut self, object: Arc<T>)

Adds a reference to an object to the collection using the object’s unique name as the key. This method is used to add objects that are already wrapped in Arc<T>.

§Arguments
  • object - An Arc<T> reference to the object to add.
Source

pub fn as_vec(&self) -> Vec<Arc<T>>

Creates a representation of the collection as a Vec of Arc<T>.

Source

pub fn contains(&self, key: &str) -> bool

Checks whether the collection contains an object with the specified name.

§Arguments
  • key - The name of the object to check for.
§Returns

A boolean indicating whether the collection contains an object with the specified name.

Source

pub fn get(&self, key: &str) -> Option<Arc<T>>

Retrieves an optional reference to an object with the specified name.

§Arguments
  • key - The name of the object to retrieve.
§Returns

An Option<Arc<T>> representing the object if found, or None if not found.

Source

pub fn insert(&mut self, key: String, object: Arc<T>)

Inserts an object into the collection without checking for duplicates.

Source

pub fn is_empty(&self) -> bool

Checks whether the collection is empty.

§Returns

A boolean indicating whether the collection is empty.

Source

pub fn iter(&self) -> Iter<'_, String, Arc<T>>

Retrieves an iterator over references to the objects in the collection.

§Returns

An iterator over items in the collection in arbitrary order.

Source

pub fn keys(&self) -> Keys<'_, String, Arc<T>>

Retrieves an iterator over the keys in the collection.

§Returns

An iterator over the keys in the collection in arbitrary order.

Source

pub fn len(&self) -> usize

Calculates the number of objects in the collection.

§Returns

The number of objects in the collection as a usize.

Source

pub fn remove(&mut self, name: &str) -> Option<Arc<T>>

Removes an object from the collection.

§Arguments
  • name - The name of the object to remove.
§Returns

An Option<Arc<T>> representing the object if found, or None if not found.

Source

pub fn values(&self) -> impl Iterator<Item = &Arc<T>>

Retrieves an iterator over references to the objects in the collection.

§Returns

An iterator over references to the objects in the collection.

Source

pub fn drain(&mut self) -> Drain<'_, String, Arc<T>>

Source

pub fn extend(&mut self, other: &mut Self)

Trait Implementations§

Source§

impl<T: Clone + ConfigObject> Clone for ConfigObjectMap<T>

Source§

fn clone(&self) -> ConfigObjectMap<T>

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<T: Debug + ConfigObject> Debug for ConfigObjectMap<T>

Source§

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

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

impl<T: Default + ConfigObject> Default for ConfigObjectMap<T>

Source§

fn default() -> ConfigObjectMap<T>

Returns the “default value” for a type. Read more
Source§

impl<'de, T: ConfigObject> Deserialize<'de> for ConfigObjectMap<T>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&ConfigObjectMap<BSMComponent>> for ConfigRefMap<BSMComponentRef>

Source§

fn from(components: &ConfigObjectMap<BSMComponent>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<BSMService>> for ConfigRefMap<BSMServiceRef>

Source§

fn from(services: &ConfigObjectMap<BSMService>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<Contact>> for ConfigRefMap<ContactRef>

Source§

fn from(contacts: &ConfigObjectMap<Contact>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<Hashtag>> for ConfigRefMap<HashtagRef>

Source§

fn from(hashtags: &ConfigObjectMap<Hashtag>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<Host>> for ConfigRefMap<HostRef>

Source§

fn from(hosts: &ConfigObjectMap<Host>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<HostCheckCommand>> for ConfigRefMap<HostCheckCommandRef>

Source§

fn from(check_commands: &ConfigObjectMap<HostCheckCommand>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<HostGroup>> for ConfigRefMap<HostGroupRef>

Source§

fn from(host_groups: &ConfigObjectMap<HostGroup>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<HostTemplate>> for ConfigRefMap<HostTemplateRef>

Source§

fn from(host_templates: &ConfigObjectMap<HostTemplate>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<MonitoringCluster>> for ConfigRefMap<MonitoringClusterRef>

Source§

fn from(clusters: &ConfigObjectMap<MonitoringCluster>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<NotificationMethod>> for ConfigRefMap<NotificationMethodRef>

Source§

fn from(methods: &ConfigObjectMap<NotificationMethod>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<NotificationProfile>> for ConfigRefMap<NotificationProfileRef>

Source§

fn from(profiles: &ConfigObjectMap<NotificationProfile>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<Role>> for ConfigRefMap<RoleRef>

Source§

fn from(roles: &ConfigObjectMap<Role>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<ServiceCheck>> for ConfigRefMap<ServiceCheckHostRef>

Source§

fn from(servicechecks: &ConfigObjectMap<ServiceCheck>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<ServiceCheck>> for ConfigRefMap<ServiceCheckRef>

Source§

fn from(servicechecks: &ConfigObjectMap<ServiceCheck>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<ServiceGroup>> for ConfigRefMap<ServiceGroupRef>

Source§

fn from(groups: &ConfigObjectMap<ServiceGroup>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<SharedNotificationProfile>> for ConfigRefMap<SharedNotificationProfileRef>

Source§

fn from(profiles: &ConfigObjectMap<SharedNotificationProfile>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<Tenancy>> for ConfigRefMap<TenancyRef>

Source§

fn from(tenancies: &ConfigObjectMap<Tenancy>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<TimePeriod>> for ConfigRefMap<TimePeriodRef>

Source§

fn from(timeperiods: &ConfigObjectMap<TimePeriod>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<Variable>> for ConfigRefMap<HostVariableRef>

Source§

fn from(variables: &ConfigObjectMap<Variable>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<Variable>> for ConfigRefMap<VariableRef>

Source§

fn from(variables: &ConfigObjectMap<Variable>) -> Self

Converts to this type from the input type.
Source§

impl From<&ConfigObjectMap<Variable>> for ConfigRefMap<VariableValueRef>

Source§

fn from(variables: &ConfigObjectMap<Variable>) -> Self

Converts to this type from the input type.
Source§

impl<T: ConfigObject> FromIterator<T> for ConfigObjectMap<T>

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T: PartialEq + ConfigObject> PartialEq for ConfigObjectMap<T>

Source§

fn eq(&self, other: &ConfigObjectMap<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PersistentMap for ConfigObjectMap<BSMComponent>

Source§

impl PersistentMap for ConfigObjectMap<BSMService>

Source§

impl PersistentMap for ConfigObjectMap<Contact>

Source§

impl PersistentMap for ConfigObjectMap<Hashtag>

Source§

impl PersistentMap for ConfigObjectMap<Host>

Source§

impl PersistentMap for ConfigObjectMap<HostCheckCommand>

Source§

impl PersistentMap for ConfigObjectMap<HostGroup>

Source§

impl PersistentMap for ConfigObjectMap<HostIcon>

Source§

impl PersistentMap for ConfigObjectMap<HostTemplate>

Source§

impl PersistentMap for ConfigObjectMap<MonitoringCluster>

Source§

impl PersistentMap for ConfigObjectMap<MonitoringServer>

Source§

impl PersistentMap for ConfigObjectMap<NetflowCollector>

Source§

impl PersistentMap for ConfigObjectMap<NetflowSource>

Source§

impl PersistentMap for ConfigObjectMap<NotificationMethod>

Source§

impl PersistentMap for ConfigObjectMap<NotificationProfile>

Source§

impl PersistentMap for ConfigObjectMap<Role>

Source§

impl PersistentMap for ConfigObjectMap<ServiceCheck>

Source§

impl PersistentMap for ConfigObjectMap<ServiceGroup>

Source§

impl PersistentMap for ConfigObjectMap<SharedNotificationProfile>

Source§

impl PersistentMap for ConfigObjectMap<Tenancy>

Source§

impl PersistentMap for ConfigObjectMap<TimePeriod>

Source§

impl PersistentMap for ConfigObjectMap<Variable>

Source§

impl<T: ConfigObject> Serialize for ConfigObjectMap<T>

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T: Eq + ConfigObject> Eq for ConfigObjectMap<T>

Source§

impl<T: ConfigObject> StructuralPartialEq for ConfigObjectMap<T>

Auto Trait Implementations§

§

impl<T> Freeze for ConfigObjectMap<T>

§

impl<T> RefUnwindSafe for ConfigObjectMap<T>
where T: RefUnwindSafe,

§

impl<T> Send for ConfigObjectMap<T>
where T: Sync + Send,

§

impl<T> Sync for ConfigObjectMap<T>
where T: Sync + Send,

§

impl<T> Unpin for ConfigObjectMap<T>

§

impl<T> UnwindSafe for ConfigObjectMap<T>
where T: RefUnwindSafe,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,