use crate::{
actors::{ActorPath, DynActorRef, MessageBounds, PathParseError},
net::{
buffers::{BufferChunk, BufferEncoder, ChunkLease, ChunkRef},
frames::FRAME_HEAD_LEN,
},
serialisation::{
ser_helpers::{deserialise_chunk_lease, deserialise_chunk_ref},
Deserialiser,
SerError,
SerId,
Serialisable,
Serialiser,
TryClone,
},
utils,
};
use bytes::{Buf, Bytes};
use std::{any::Any, convert::TryFrom, ops::Deref, str::FromStr};
use uuid::Uuid;
mod net_message;
pub use net_message::*;
mod registration;
pub use registration::*;
mod serialised;
pub use serialised::*;
pub(crate) mod dispatch;
pub use dispatch::*;
mod deser_macro;
use crate::{net::SocketAddr, prelude::NetworkStatus};
pub use deser_macro::*;
pub mod framing;
#[derive(Debug)]
pub enum EventEnvelope {
Network(NetworkStatus),
RejectedData((SocketAddr, Box<DispatchData>)),
}
#[derive(Debug)]
#[allow(clippy::large_enum_variant)]
pub enum MsgEnvelope<M: MessageBounds> {
Typed(M),
Net(NetMessage),
}
#[derive(Debug, Clone)]
pub enum PathResolvable {
Path(ActorPath),
ActorId(Uuid),
Alias(String),
Segments(Vec<String>),
System,
}
impl From<ActorPath> for PathResolvable {
fn from(path: ActorPath) -> Self {
PathResolvable::Path(path)
}
}
impl TryFrom<String> for PathResolvable {
type Error = PathParseError;
fn try_from(value: String) -> Result<Self, Self::Error> {
let parsed = crate::actors::parse_path(&value);
crate::actors::validate_lookup_path(&parsed).map(|_| PathResolvable::Alias(value))
}
}
impl FromStr for PathResolvable {
type Err = PathParseError;
fn from_str(value: &str) -> Result<Self, Self::Err> {
let parsed = crate::actors::parse_path(value);
crate::actors::validate_lookup_path(&parsed)
.map(|_| PathResolvable::Alias(value.to_string()))
}
}