docs icon indicating copy to clipboard operation
docs copied to clipboard

Add a diagram of the Agent lifecycle

Open jstarry opened this issue 5 years ago • 2 comments

DOC TODO: https://yew.rs/docs/concepts/agents#lifecycle

Describe the lifecycle methods of an Agent and the lifetime of each type of Agent (Job, Context, Private, Public)

    /// Creates an instance of an agent.
    fn create(link: AgentLink<Self>) -> Self;

    /// This method called on every update message.
    fn update(&mut self, msg: Self::Message);

    /// This method called on when a new bridge created.
    fn connected(&mut self, _id: HandlerId) {}

    /// This method called on every incoming message.
    fn handle_input(&mut self, msg: Self::Input, id: HandlerId);

    /// This method called on when a new bridge destroyed.
    fn disconnected(&mut self, _id: HandlerId) {}

    /// This method called when the agent is destroyed.
    fn destroy(&mut self) {}

jstarry avatar Feb 09 '20 02:02 jstarry

I'm not exactly sure where all the arrows should go, but would a diagram like this do the trick? Diagram. The diagram was made with nomnoml.com.

teymour-aldridge avatar Apr 13 '20 13:04 teymour-aldridge

Thanks @teymour-aldridge this is a good start! It'd be great if this was added to the docs :)

jstarry avatar Apr 14 '20 02:04 jstarry