pub struct Param<'a> { /* private fields */ }Expand description
Represents a parameter struct.
Implementations§
Source§impl<'a> Param<'a>
impl<'a> Param<'a>
Sourcepub fn get<F: FromStr>(&self, id: &str) -> Option<F>
pub fn get<F: FromStr>(&self, id: &str) -> Option<F>
Retrieves the value associated with the specified id from the parameter data.
§Arguments
id- The identifier to search for.
§Returns
Some(String)- The value associated with theid, if found.None- If no value is associated with theid.
§Examples
ⓘ
let param = Param {
data: vec![
("id", "123"),
("name", "John"),
],
};
assert_eq!(param.get("id"), Some("123".to_string()));
assert_eq!(param.get("name"), Some("John".to_string()));
assert_eq!(param.get("age"), None);Trait Implementations§
Source§impl<'a: 'b, 'b> Transformer<'a> for Param<'b>
impl<'a: 'b, 'b> Transformer<'a> for Param<'b>
Source§fn transform(cx: &'a mut NgynContext<'_>) -> Self
fn transform(cx: &'a mut NgynContext<'_>) -> Self
Auto Trait Implementations§
impl<'a> Freeze for Param<'a>
impl<'a> RefUnwindSafe for Param<'a>
impl<'a> Send for Param<'a>
impl<'a> Sync for Param<'a>
impl<'a> Unpin for Param<'a>
impl<'a> UnsafeUnpin for Param<'a>
impl<'a> UnwindSafe for Param<'a>
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