pub enum Sub<M> {
None,
Tick {
id: u64,
every: Duration,
produce: fn() -> M,
},
Stream {
id: u64,
name: &'static str,
every: Duration,
produce: fn() -> M,
},
WebSocket {
id: u64,
url: &'static str,
every: Duration,
produce: fn() -> M,
},
MapMsg {
inner: Box<Sub<()>>,
map: fn(()) -> M,
},
Batch(Vec<Sub<M>>),
}Expand description
Subscription descriptions — interpreted in crate::subscription / crate::runtime (requires runtime feature).
Variants§
Implementations§
Source§impl<M> Sub<M>
impl<M> Sub<M>
pub fn none() -> Self
pub fn tick(id: u64, every: Duration, produce: fn() -> M) -> Self
pub fn stream( id: u64, name: &'static str, every: Duration, produce: fn() -> M, ) -> Self
pub fn websocket( id: u64, url: &'static str, every: Duration, produce: fn() -> M, ) -> Self
Sourcepub fn map_msg(inner: Sub<()>, map: fn(()) -> M) -> Self
pub fn map_msg(inner: Sub<()>, map: fn(()) -> M) -> Self
Wrap a Sub<()> and map each firing into M (Elm Sub.map).
Sourcepub fn map<N>(self, _f: fn(M) -> N) -> Sub<N>
pub fn map<N>(self, _f: fn(M) -> N) -> Sub<N>
Map batched subscription outputs. For leaf ticks/streams, use explicit produce fns or
Self::map_msg at the target action type.
pub fn batch(subs: impl IntoIterator<Item = Sub<M>>) -> Self
pub fn id(&self) -> Option<u64>
Trait Implementations§
impl<M: Eq> Eq for Sub<M>
impl<M> StructuralPartialEq for Sub<M>
Auto Trait Implementations§
impl<M> Freeze for Sub<M>
impl<M> RefUnwindSafe for Sub<M>
impl<M> Send for Sub<M>
impl<M> Sync for Sub<M>
impl<M> Unpin for Sub<M>
impl<M> UnsafeUnpin for Sub<M>
impl<M> UnwindSafe for Sub<M>
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