maliput

Struct ResourceManager

Source
pub struct ResourceManager { /* private fields */ }
Expand description

§ResourceManager

Convenient method for getting the path to the resources of the backends.

§Backends

  • maliput_malidrive: Resources from maliput_malidrive are brought by maliput-sdk package. All the maliput_malidrive resources are stored in the same directory: (See https://github.com/maliput/maliput_malidrive/tree/main/resources)

§Example

How to get all the resources from the maliput_malidrive backend:

let resource_manager = maliput::ResourceManager::new();
let all_resources_in_malidrive = resource_manager.get_all_resources_by_backend("maliput_malidrive");

How to get the path to the TShapeRoad.xodr file from the maliput_malidrive backend:

let resource_manager = maliput::ResourceManager::new();
let t_shape_road_xodr_path = resource_manager.get_resource_path_by_name("maliput_malidrive", "TShapeRoad.xodr");
assert!(t_shape_road_xodr_path.is_some());
assert!(t_shape_road_xodr_path.unwrap().exists());

Implementations§

Source§

impl ResourceManager

Source

pub fn new() -> ResourceManager

Creates a new ResourceManager.

Source

pub fn get_resource_path_by_name( &self, backend_name: &str, resource_name: &str, ) -> Option<PathBuf>

Obtains the path to a resource by its name.

§Arguments
  • backend_name - The name of the backend.
  • resource_name - The name of the resource.
§Returns

The path to the resource if it exists, otherwise None.

Source

pub fn get_all_resources_by_backend( &self, backend_name: &str, ) -> Option<&Vec<PathBuf>>

Obtains all the resources from a backend.

§Arguments
  • backend_name - The name of the backend.
§Returns

A vector with all the resources from the backend if it exists, otherwise None.

Source

pub fn get_all_resources(&self) -> &HashMap<String, Vec<PathBuf>>

Get the underlying collection that stores all the resources for each backend.

Trait Implementations§

Source§

impl Default for ResourceManager

Source§

fn default() -> Self

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

Auto Trait Implementations§

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> 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, 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.