Struct KeepAlive

#[must_use]
pub struct KeepAlive { /* private fields */ }

Configure the interval between keep-alive messages, the content of each message, and the associated stream.

Implementations

impl KeepAlive

fn new() -> Self

Create a new KeepAlive.

fn interval(self, time: Duration) -> Self

Customize the interval between keep-alive messages.

Default is 15 seconds.

fn text<I>(self, text: I) -> Self
where
    I: AsRef<str>,

Customize the text of the keep-alive message.

Default is an empty comment.

Panics

Panics if text contains any newline or carriage returns, as they are not allowed in SSE comments.

fn event(self, event: Event) -> Self

Customize the event of the keep-alive message.

Default is an empty comment.

Panics

Panics if event contains any newline or carriage returns, as they are not allowed in SSE comments.

Trait Implementations

impl Clone for KeepAlive

fn clone(&self) -> KeepAlive

impl Debug for KeepAlive

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Default for KeepAlive

fn default() -> Self

Auto Trait Implementations

impl !Freeze for KeepAlive

impl RefUnwindSafe for KeepAlive

impl Send for KeepAlive

impl Sync for KeepAlive

impl Unpin for KeepAlive

impl UnsafeUnpin for KeepAlive

impl UnwindSafe for KeepAlive

Blanket Implementations

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for KeepAlive where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for KeepAlive where ST: ?Sized, DT: ?Sized,

impl<T> Any for KeepAlive where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for KeepAlive where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for KeepAlive where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for KeepAlive where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for KeepAlive

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> FromRef<T> for KeepAlive where T: Clone,

fn from_ref(input: &T) -> T

impl<T> Instrument for KeepAlive

impl<T> Read<Exclusive, BecauseExclusive> for KeepAlive where T: ?Sized,

impl<T> Same for KeepAlive

type Output = T;

impl<T> ToOwned for KeepAlive where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> WithSubscriber for KeepAlive

impl<T, U> Into<U> for KeepAlive where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for KeepAlive where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for KeepAlive where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

impl<V, T> VZip<V> for KeepAlive where V: MultiLane<T>,

fn vzip(self) -> V