[−][src]Struct active_sse::Config
Methods
impl Config
[src]
pub fn activity(url: &str) -> Config
[src]
Create an activity config
This function creates a new activity configuration that points to a specified URL. Subscribing to an activity will listen for stream creation and update activity. It can be used as is to listen globally or it can be given a specific stream to listen for updates.
Listen globally
let mut config = Config::activity("http://localhost:5260");
Listen to a specific stream
let mut config = Config::activity("http://localhost:5260"); config.set_stream_id("stream id");
pub fn event(url: &str) -> Config
[src]
Create an event config
This function creates a new event configuration that points to a specified URL. This configuration can be used as is to listen for all events on a network, it can be given a contract to listen to all events triggered by that contract, or it can be given both a contract and an event to listen to.
Listen globally
let mut config = Config::activity("http://localhost:5260");
/// ## Listen to all events from a contract
let mut config = Config::event("http://localhost:5260"); config.set_contract("contract id").unwrap();
Listen for a specific event on a contract
let mut config = Config::event("http://localhost:5260"); config.set_contract("contract_id").unwrap(); config.set_event("event").unwrap();
pub fn set_stream_id(&mut self, id: &str) -> SSEResult<&mut Self>
[src]
Listen for activity on a specific stream
This function sets the stream id stored in a confuiguration object. It can be used to listen for any activity on a specific stream.
let mut config = Config::activity("http://localhost:5260"); config.set_stream_id("stream id").unwrap();
pub fn set_contract(&mut self, contract: &str) -> SSEResult<&mut Self>
[src]
Listen for events on a specific contract
This function sets the contract id stored in a confuiguration object. It can be used to listen for any events on a specific contract.
let mut config = Config::event("http://localhost:5260"); config.set_contract("contract id").unwrap();
pub fn set_event(&mut self, event: &str) -> SSEResult<&mut Self>
[src]
Listen for a specific event on a specific contract
This function sets the event name stored in a confuiguration object. It can be used to listen for a specific events on a specific contract.
A contract must be set before an event name can be provided.
let mut config = Config::event("http://localhost:5260"); config.set_contract("contract id").unwrap(); config.set_event("event").unwrap();
Auto Trait Implementations
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
impl RefUnwindSafe for Config
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,