pub struct NameMap { /* private fields */ }Expand description
Maps old resource names to new resource names, keyed by (ResourceKind, old_name).
Implementations§
Source§impl NameMap
impl NameMap
pub fn new() -> Self
pub fn insert(&mut self, kind: ResourceKind, old: &str, new: &str)
pub fn get(&self, kind: ResourceKind, old: &str) -> Option<&str>
Sourcepub fn from_suffix(resources: &[(ResourceKind, String)], suffix: &str) -> Self
pub fn from_suffix(resources: &[(ResourceKind, String)], suffix: &str) -> Self
Create a NameMap by appending a suffix to all resource names.
Sourcepub fn from_answers_file(path: &Path) -> Result<Self>
pub fn from_answers_file(path: &Path) -> Result<Self>
Load a NameMap from a JSON answers file.
Expected format:
{
"indexes": { "old-name": "new-name" },
"indexers": { "old-indexer": "new-indexer" }
}Keys are the api_path() values for each resource kind.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NameMap
impl RefUnwindSafe for NameMap
impl Send for NameMap
impl Sync for NameMap
impl Unpin for NameMap
impl UnwindSafe for NameMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more