pub struct Event {
id: Option<String>,
data: Option<DataType>,
event: Option<String>,
comment: Option<String>,
retry: Option<Duration>,
}
Expand description
Server-sent event
Fields§
§id: Option<String>
§data: Option<DataType>
§event: Option<String>
§comment: Option<String>
§retry: Option<Duration>
Implementations§
source§impl Event
impl Event
sourcepub fn data<T: Into<String>>(self, data: T) -> Event
pub fn data<T: Into<String>>(self, data: T) -> Event
Set Server-sent event data
data field(s) (“data:
sourcepub fn json_data<T: Serialize>(self, data: T) -> Result<Event, Error>
pub fn json_data<T: Serialize>(self, data: T) -> Result<Event, Error>
Set Server-sent event data
data field(s) (“data:
sourcepub fn comment<T: Into<String>>(self, comment: T) -> Event
pub fn comment<T: Into<String>>(self, comment: T) -> Event
Set Server-sent event comment
Comment field (“:
sourcepub fn event<T: Into<String>>(self, event: T) -> Event
pub fn event<T: Into<String>>(self, event: T) -> Event
Set Server-sent event event
Event name field (“event:
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin 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