Subscription

Struct Subscription 

Source
pub struct Subscription<'dis>(/* private fields */);
Expand description

Subscription is from Observable pattern, it is used to unsubscribe the observable. The dispose method of Disposable will be called when the subscription is unsubscribe or dropped.

Implementations§

Source§

impl<'dis> Subscription<'dis>

Source

pub fn new() -> Self

Source

pub fn new_with_disposal( disposable: impl Disposable + NecessarySendSync + 'dis, ) -> Self

Source

pub fn new_with_disposal_callback( callback: impl FnOnce() + NecessarySendSync + 'dis, ) -> Self

Source

pub fn append_disposable( &mut self, disposable: impl Disposable + NecessarySendSync + 'dis, )

Trait Implementations§

Source§

impl<'dis, T> Add<T> for Subscription<'dis>
where T: Disposable + NecessarySendSync + 'dis,

Source§

type Output = Subscription<'dis>

The resulting type after applying the + operator.
Source§

fn add(self, other: T) -> Subscription<'dis>

Performs the + operation. Read more
Source§

impl<'dis> Debug for Subscription<'dis>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'dis> Default for Subscription<'dis>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Disposable for Subscription<'_>

Source§

fn dispose(self)

Disposes of the resource.

Auto Trait Implementations§

§

impl<'dis> Freeze for Subscription<'dis>

§

impl<'dis> !RefUnwindSafe for Subscription<'dis>

§

impl<'dis> Send for Subscription<'dis>

§

impl<'dis> Sync for Subscription<'dis>

§

impl<'dis> Unpin for Subscription<'dis>

§

impl<'dis> !UnwindSafe for Subscription<'dis>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T> NecessarySendSync for T
where T: Send + Sync,