1use crate::{
3 actors::{ActorPath, DynActorRef, MessageBounds, PathParseError},
4 net::{
5 buffers::{BufferChunk, BufferEncoder, ChunkLease, ChunkRef},
6 frames::FRAME_HEAD_LEN,
7 },
8 serialisation::{
9 ser_helpers::{deserialise_chunk_lease, deserialise_chunk_ref},
10 Deserialiser,
11 SerError,
12 SerId,
13 Serialisable,
14 Serialiser,
15 TryClone,
16 },
17 utils,
18};
19use bytes::{Buf, Bytes};
20use std::{any::Any, convert::TryFrom, ops::Deref, str::FromStr};
21use uuid::Uuid;
22mod net_message;
23pub use net_message::*;
24mod registration;
25pub use registration::*;
26mod serialised;
27pub use serialised::*;
28pub(crate) mod dispatch;
29pub use dispatch::*;
30mod deser_macro;
31use crate::{net::SocketAddr, prelude::NetworkStatus};
32#[allow(unused_imports)]
33pub use deser_macro::*;
34pub mod bitfields;
35pub mod framing;
36
37#[derive(Debug)]
41pub enum EventEnvelope {
42 Network(NetworkStatus),
44 RejectedData((SocketAddr, Box<DispatchData>)),
46}
47
48#[derive(Debug)]
50#[allow(clippy::large_enum_variant)]
51pub enum MsgEnvelope<M: MessageBounds> {
52 Typed(M),
54 Net(NetMessage),
56}
57
58#[derive(Debug, Clone)]
60pub enum PathResolvable {
61 Path(ActorPath),
63 ActorId(Uuid),
67 Alias(String),
71 Segments(Vec<String>),
75 System,
77}
78
79impl From<ActorPath> for PathResolvable {
80 fn from(path: ActorPath) -> Self {
81 PathResolvable::Path(path)
82 }
83}
84impl TryFrom<String> for PathResolvable {
85 type Error = PathParseError;
86
87 fn try_from(value: String) -> Result<Self, Self::Error> {
88 let parsed = crate::actors::parse_path(&value);
89 crate::actors::validate_lookup_path(&parsed).map(|_| PathResolvable::Alias(value))
90 }
91}
92impl FromStr for PathResolvable {
93 type Err = PathParseError;
94
95 fn from_str(value: &str) -> Result<Self, Self::Err> {
96 let parsed = crate::actors::parse_path(value);
97 crate::actors::validate_lookup_path(&parsed)
98 .map(|_| PathResolvable::Alias(value.to_string()))
99 }
100}