[][src]Struct ament_rs::ament::Ament

pub struct Ament {
    pub prefixes: Vec<String>,
}

Stores a list of prefixes in which resources will be searched.

Fields

prefixes: Vec<String>

The list of prefixes in which resources will be searched.

Methods

impl Ament[src]

pub fn new() -> Result<Self, VarError>[src]

Constructs a new Ament struct with prefixes read from the AMENT_PREFIX_PATH environment variable.

Errors

A std::env::VarError is returned if the AMENT_PREFIX_PATH environment variable is not set.

pub fn from_var(env_var: impl AsRef<str>) -> Result<Self, VarError>[src]

Constructs a new Ament struct with prefixes read from the given environment variable.

Errors

A std::env::VarError is returned if the given environment variable is not set.

pub fn get_packages_prefix(&self) -> HashMap<String, String>[src]

Returns a map containing packages name for key and the first prefix in which each package was found for value.

pub fn get_packages_prefixes(&self) -> HashMap<String, Vec<String>>[src]

Returns a map containing packages name for key and the list of prefixes in which each package was found for value.

pub fn get_package_share_directory(
    &self,
    package_name: impl AsRef<str>
) -> Option<PathBuf>
[src]

Returns the share directory of the package or None is the package was not found.

pub fn find_package(&self, package_name: impl AsRef<str>) -> Option<String>[src]

Returns the prefix in which the given package has been found or None if the package has not been found.

pub fn has_package(&self, package_name: impl AsRef<str>) -> bool[src]

Returns true if the given package exists in the ament resource index, returns false otherwise.

pub fn get_resource(
    &self,
    resource_name: impl AsRef<str>,
    resource_type: impl AsRef<str>
) -> Option<(Result<Vec<u8>>, String)>
[src]

Returns the content of the resource if the given resource exists in the ament resource index, or None if the resource was not found.

pub fn get_resources_prefix(
    &self,
    resource_type: impl AsRef<str>
) -> HashMap<String, String>
[src]

Returns a map containing resources name for key and the first prefix in which each resource was found for value.

pub fn get_resources_prefixes(
    &self,
    resource_type: impl AsRef<str>
) -> HashMap<String, Vec<String>>
[src]

Returns a map containing resources name for key and the list of prefixes in which each resource was found for value.

pub fn find_resource(
    &self,
    resource_name: impl AsRef<str>,
    resource_type: impl AsRef<str>
) -> Option<String>
[src]

Returns the prefix in which the given resource was found or None if the resource was not found.

pub fn has_resource(
    &self,
    resource_name: impl AsRef<str>,
    resource_type: impl AsRef<str>
) -> bool
[src]

Returns true if the given resource exists in the ament resource index, returns false otherwise.

Trait Implementations

impl PartialEq<Ament> for Ament[src]

impl Clone for Ament[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Ament[src]

Auto Trait Implementations

impl Send for Ament

impl Sync for Ament

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]