pub struct Fields<'a>(pub &'a [(&'a str, Value<'a>)]);Expand description
A ready-made view over a slice of named values, for small pages, error pages, and tests. Its shape is anonymous: names are looked up per render.
use web_net::{Fields, Value, View};
let view = Fields(&[("title", Value::Text("Hello")), ("count", Value::Int(3))]);
let key = view.shape().key("count").unwrap();
assert!(matches!(view.get(key), Value::Int(3)));Tuple Fields§
§0: &'a [(&'a str, Value<'a>)]Trait Implementations§
impl<'a> Copy for Fields<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Fields<'a>
impl<'a> !Send for Fields<'a>
impl<'a> !Sync for Fields<'a>
impl<'a> !UnwindSafe for Fields<'a>
impl<'a> Forget for Fields<'a>
impl<'a> Freeze for Fields<'a>
impl<'a> Unpin for Fields<'a>
impl<'a> UnsafeUnpin for Fields<'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