[−][src]Struct hyper_usse::EventBuilder
A struct used to build server sent events.
Examples
Build an event with just data:
EventBuilder::new("Data").build();
Build an event with an ID:
EventBuilder::new("Data").id("Id").build();
Build an event with an event type:
EventBuilder::new("Data").event_type("update").build();
Because EventBuilder
implements Into<Bytes>
you don't have to call build
to pass it to
the server.
Fields
data: &'data str
id: Option<&'id str>
event_type: Option<&'event str>
Methods
impl<'data, 'id, 'event> EventBuilder<'data, 'id, 'event>
[src]
pub fn new(data: &'data str) -> Self
[src]
Create a new builder with data, no id and no event type.
pub fn data(self, data: &'data str) -> Self
[src]
Set the data.
pub fn id(self, id: &'id str) -> Self
[src]
Set the event id.
pub fn event_type(self, event_type: &'event str) -> Self
[src]
Set the event type.
pub fn clear_id(self) -> Self
[src]
Clear the event id.
pub fn clear_type(self) -> Self
[src]
Clear the event type.
pub fn build(self) -> String
[src]
Build the event.
Trait Implementations
impl<'data, 'id, 'event> Clone for EventBuilder<'data, 'id, 'event>
[src]
fn clone(&self) -> EventBuilder<'data, 'id, 'event>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'data, 'id, 'event> Copy for EventBuilder<'data, 'id, 'event>
[src]
impl<'data, 'id, 'event> Debug for EventBuilder<'data, 'id, 'event>
[src]
impl<'data, 'id, 'event> Display for EventBuilder<'data, 'id, 'event>
[src]
impl<'data, 'id, 'event> Eq for EventBuilder<'data, 'id, 'event>
[src]
impl<'data, 'id, 'event> Into<Bytes> for EventBuilder<'data, 'id, 'event>
[src]
impl<'data, 'id, 'event> PartialEq<EventBuilder<'data, 'id, 'event>> for EventBuilder<'data, 'id, 'event>
[src]
fn eq(&self, other: &EventBuilder<'data, 'id, 'event>) -> bool
[src]
fn ne(&self, other: &EventBuilder<'data, 'id, 'event>) -> bool
[src]
impl<'data, 'id, 'event> StructuralEq for EventBuilder<'data, 'id, 'event>
[src]
impl<'data, 'id, 'event> StructuralPartialEq for EventBuilder<'data, 'id, 'event>
[src]
Auto Trait Implementations
impl<'data, 'id, 'event> RefUnwindSafe for EventBuilder<'data, 'id, 'event>
impl<'data, 'id, 'event> Send for EventBuilder<'data, 'id, 'event>
impl<'data, 'id, 'event> Sync for EventBuilder<'data, 'id, 'event>
impl<'data, 'id, 'event> Unpin for EventBuilder<'data, 'id, 'event>
impl<'data, 'id, 'event> UnwindSafe for EventBuilder<'data, 'id, 'event>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,