pub enum PacketSource {
Client,
Server,
}Expand description
Represents the source of a packet.
Variants§
Client
This packet was sent by the client.
Common names include: <name>Req, <name>Notify, <name>C2S<side>
Server
This packet was sent by the server.
Common names include: <name>Rsp, <name>Notify, <name>S2C<side>
Implementations§
Source§impl PacketSource
impl PacketSource
Sourcepub fn from(config: &Config, port: u16) -> PacketSource
pub fn from(config: &Config, port: u16) -> PacketSource
Determines the packet source based on the configuration and port.
§Example
use ys_sniffer::{PacketSource, Config};
let config = Config {
server_port: vec![22101, 22102],
..Default::default()
};
let result = PacketSource::from(&config, 22101);
assert_eq!(result, PacketSource::Server);Trait Implementations§
Source§impl Clone for PacketSource
impl Clone for PacketSource
Source§fn clone(&self) -> PacketSource
fn clone(&self) -> PacketSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PacketSource
Source§impl Debug for PacketSource
impl Debug for PacketSource
Source§impl Default for PacketSource
impl Default for PacketSource
Source§impl<'de> Deserialize<'de> for PacketSource
impl<'de> Deserialize<'de> for PacketSource
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for PacketSource
impl Display for PacketSource
Source§impl PartialEq for PacketSource
impl PartialEq for PacketSource
Source§fn eq(&self, other: &PacketSource) -> bool
fn eq(&self, other: &PacketSource) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for PacketSource
impl Serialize for PacketSource
impl StructuralPartialEq for PacketSource
Auto Trait Implementations§
impl Freeze for PacketSource
impl RefUnwindSafe for PacketSource
impl Send for PacketSource
impl Sync for PacketSource
impl Unpin for PacketSource
impl UnsafeUnpin for PacketSource
impl UnwindSafe for PacketSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more