2025-06-02 15:00:32 +02:00

20 lines
821 B
Nim

import pkg/chronos
import pkg/questionable/results
type Component* = ref object of RootObj
method awake*(c: Component): Future[?!void] {.async: (raises: [CancelledError]), base.} =
# Awake is called on all components in an unspecified order.
# Use this method to subscribe/connect to other components.
return success()
method start*(c: Component): Future[?!void] {.async: (raises: [CancelledError]), base.} =
# Start is called on all components in an unspecified order.
# Is is guaranteed that all components have already successfulled handled 'awake'.
# Use this method to begin the work of this component.
return success()
method stop*(c: Component): Future[?!void] {.async: (raises: [CancelledError]), base.} =
# Use this method to stop, unsubscribe, and clean up any resources.
return success()