Teardown API

Any subscription-like object should implement a valid teardown logic.

Example

using Rocket

struct MuCustomSubscription <: Teardown
    # some fields here
end

Rocket.as_teardown(::Type{<:MuCustomSubscription}) = UnsubscribableTeardownLogic()

function on_unsubscribe!(subscription::MyCustomSubscription)
    # dispose resources here
end

Traits

Rocket.as_teardownFunction
as_teardown(::Type)

This function checks teardown trait behavior specification. Should be used explicitly to specify teardown logic trait behavior for any object.

Examples

using Rocket

struct MySubscription <: Teardown end

Rocket.as_teardown(::Type{<:MySubscription}) = UnsubscribableTeardownLogic()
Rocket.on_unsubscribe!(s::MySubscription)    = println("Unsubscribed!")

subscription = MySubscription()
unsubscribe!(subscription)
;

# output

Unsubscribed!

See also: Teardown, TeardownLogic

source

Types

Errors