pub struct Event {
pub name: String,
pub target: Option<String>,
pub value: Value,
pub metadata: Map<String, Value>,
}Expand description
A normalized browser event delivered to a LiveView.
§Examples
use shelly::Event;
let mut event = Event::new("save_profile");
event.target = Some("profile-form".to_string());
assert_eq!(event.name, "save_profile");
assert_eq!(event.target.as_deref(), Some("profile-form"));Fields§
§name: StringLogical event name, for example inc, save_profile, or validate.
target: Option<String>Optional DOM target id or client-provided target scope.
value: ValueEvent value. For forms, this is usually an object built from FormData.
metadata: Map<String, Value>Non-authoritative browser metadata.
Treat this data as untrusted. Use it for diagnostics or UX hints, not authorization.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
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 TryFrom<ClientMessage> for Event
impl TryFrom<ClientMessage> for Event
Source§type Error = ShellyError
type Error = ShellyError
The type returned in the event of a conversion error.
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl UnwindSafe for Event
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