Struct tentacle::builder::MetaBuilder [−][src]
Builder for protocol meta
Implementations
impl MetaBuilder
[src]
pub fn new() -> Self
[src]
New a default builder
pub fn id(self, id: ProtocolId) -> Self
[src]
Define protocol id
It is just an internal index of the system that identifies the open/close and message transfer for the specified protocol.
pub fn name<T: Fn(ProtocolId) -> String + 'static + Send + Sync>(
self,
name: T
) -> Self
[src]
self,
name: T
) -> Self
Define protocol name, default is "/p2p/protocol_id"
Used to interact with the remote service to determine whether the protocol is supported.
If not found, the protocol connection(not session just sub stream) will be closed,
and return a ProtocolSelectError
event.
pub fn support_versions(self, versions: Vec<String>) -> Self
[src]
Define protocol support versions, default is vec!["0.0.1".to_owned()]
Used to interact with the remote service to confirm that both parties open the same version of the protocol.
If not found, the protocol connection(not session just sub stream) will be closed,
and return a ProtocolSelectError
event.
pub fn codec<T: Fn() -> Box<dyn Codec + Send + 'static> + 'static + Send + Sync>(
self,
codec: T
) -> Self
[src]
self,
codec: T
) -> Self
Define protocol codec, default is LengthDelimitedCodec
pub fn service_handle<T: FnOnce() -> ProtocolHandle<Box<dyn ServiceProtocol + Send + Unpin + 'static>>>(
self,
service_handle: T
) -> Self
[src]
self,
service_handle: T
) -> Self
Define protocol service handle, default is neither
pub fn session_handle<T: FnMut() -> ProtocolHandle<Box<dyn SessionProtocol + Send + Unpin + 'static>> + Send + 'static>(
self,
session_handle: T
) -> Self
[src]
self,
session_handle: T
) -> Self
Define protocol session handle, default is neither
pub fn protocol_spawn<T: ProtocolSpawn + Send + Sync + 'static>(
self,
spawn: T
) -> Self
[src]
self,
spawn: T
) -> Self
Define the spawn process of the protocol read part
Mutually exclusive with protocol handle
pub fn select_version<T>(self, f: T) -> Self where
T: Fn() -> Option<SelectFn<String>> + Send + Sync + 'static,
[src]
T: Fn() -> Option<SelectFn<String>> + Send + Sync + 'static,
Protocol version selection rule, default is select_version
pub fn before_send<T>(self, f: T) -> Self where
T: Fn(Bytes) -> Bytes + 'static + Send,
[src]
T: Fn(Bytes) -> Bytes + 'static + Send,
Unified processing of messages before they are sent
pub fn before_receive<T>(self, f: T) -> Self where
T: Fn() -> Option<Box<dyn Fn(BytesMut) -> Result<Bytes, Error> + Send + 'static>> + Send + Sync + 'static,
[src]
T: Fn() -> Option<Box<dyn Fn(BytesMut) -> Result<Bytes, Error> + Send + 'static>> + Send + Sync + 'static,
Unified processing of messages before user received
pub fn flag(self, flag: BlockingFlag) -> Self
[src]
Set a flag to control function behavior
pub fn build(self) -> ProtocolMeta
[src]
Combine the configuration of this builder to create a ProtocolMeta
Trait Implementations
impl Default for MetaBuilder
[src]
Auto Trait Implementations
impl !RefUnwindSafe for MetaBuilder
impl Send for MetaBuilder
impl !Sync for MetaBuilder
impl Unpin for MetaBuilder
impl !UnwindSafe for MetaBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,