Struct hyper_scripter::config::Alias
source · pub struct Alias {
pub after: Vec<String>,
}
Fields§
§after: Vec<String>
Implementations§
source§impl Alias
impl Alias
sourcepub fn args(&self) -> (bool, impl Iterator<Item = &str>)
pub fn args(&self) -> (bool, impl Iterator<Item = &str>)
use hyper_scripter::config::Alias;
fn get_args(alias: &Alias) -> (bool, Vec<&str>) {
let (is_shell, args) = alias.args();
(is_shell, args.collect())
}
let alias = Alias::from(vec!["!".to_owned()]);
assert_eq!((false, vec!["!"]), get_args(&alias));
let alias = Alias::from(vec!["!".to_owned(), "args".to_owned()]);
assert_eq!((false, vec!["!", "args"]), get_args(&alias));
let alias = Alias::from(vec!["! args".to_owned()]);
assert_eq!((false, vec!["! args"]), get_args(&alias));
let alias = Alias::from(vec!["!!".to_owned()]);
assert_eq!((true, vec!["!"]), get_args(&alias));
let alias = Alias::from(vec!["!ls".to_owned()]);
assert_eq!((true, vec!["ls"]), get_args(&alias));
let alias = Alias::from(vec!["!ls".to_owned(), "*".to_owned()]);
assert_eq!((true, vec!["ls", "*"]), get_args(&alias));
Trait Implementations§
source§impl<'de> Deserialize<'de> for Alias
impl<'de> Deserialize<'de> for Alias
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 PartialEq for Alias
impl PartialEq for Alias
impl Eq for Alias
impl StructuralEq for Alias
impl StructuralPartialEq for Alias
Auto Trait Implementations§
impl RefUnwindSafe for Alias
impl Send for Alias
impl Sync for Alias
impl Unpin for Alias
impl UnwindSafe for Alias
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.