Struct HandshakePacket

Source
pub struct HandshakePacket<'a> { /* private fields */ }
Expand description

Represents MySql’s initial handshake packet.

Implementations§

Source§

impl<'a> HandshakePacket<'a>

Source

pub fn new( protocol_version: u8, server_version: impl Into<Cow<'a, [u8]>>, connection_id: u32, scramble_1: [u8; 8], scramble_2: Option<impl Into<Cow<'a, [u8]>>>, capabilities: CapabilityFlags, default_collation: u8, status_flags: StatusFlags, auth_plugin_name: Option<impl Into<Cow<'a, [u8]>>>, ) -> Self

Source

pub fn with_mariadb_ext_capabilities(self, flags: MariadbCapabilities) -> Self

Source

pub fn into_owned(self) -> HandshakePacket<'static>

Source

pub fn protocol_version(&self) -> u8

Value of the protocol_version field of an initial handshake packet.

Source

pub fn server_version_ref(&self) -> &[u8]

Value of the server_version field of an initial handshake packet as a byte slice.

Source

pub fn server_version_str(&self) -> Cow<'_, str>

Value of the server_version field of an initial handshake packet as a string (lossy converted).

Source

pub fn server_version_parsed(&self) -> Option<(u16, u16, u16)>

Parsed server version.

Will parse first \d+.\d+.\d+ of a server version string (if any).

Source

pub fn maria_db_server_version_parsed(&self) -> Option<(u16, u16, u16)>

Parsed mariadb server version.

Source

pub fn connection_id(&self) -> u32

Value of the connection_id field of an initial handshake packet.

Source

pub fn scramble_1_ref(&self) -> &[u8]

Value of the scramble_1 field of an initial handshake packet as a byte slice.

Source

pub fn scramble_2_ref(&self) -> Option<&[u8]>

Value of the scramble_2 field of an initial handshake packet as a byte slice.

Note that this may include a terminating null character.

Source

pub fn nonce(&self) -> Vec<u8>

Returns concatenated auth plugin nonce.

Source

pub fn capabilities(&self) -> CapabilityFlags

Value of a server capabilities.

Source

pub fn mariadb_ext_capabilities(&self) -> MariadbCapabilities

Value of MariaDB specific server capabilities

Source

pub fn default_collation(&self) -> u8

Value of the default_collation field of an initial handshake packet.

Source

pub fn status_flags(&self) -> StatusFlags

Value of a status flags.

Source

pub fn auth_plugin_name_ref(&self) -> Option<&[u8]>

Value of the auth_plugin_name field of an initial handshake packet as a byte slice.

Source

pub fn auth_plugin_name_str(&self) -> Option<Cow<'_, str>>

Value of the auth_plugin_name field of an initial handshake packet as a string (lossy converted).

Source

pub fn auth_plugin(&self) -> Option<AuthPlugin<'_>>

Auth plugin of a handshake packet

Trait Implementations§

Source§

impl<'a> Clone for HandshakePacket<'a>

Source§

fn clone(&self) -> HandshakePacket<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for HandshakePacket<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> MyDeserialize<'de> for HandshakePacket<'de>

Source§

const SIZE: Option<usize> = None

Size hint of a serialized value (in bytes), if it’s constant.
Source§

type Ctx = ()

Some structs defines deserialization in the context of another value. Read more
Source§

fn deserialize((): Self::Ctx, buf: &mut ParseBuf<'de>) -> Result<Self>

Deserializes self from the given buf. Read more
Source§

impl MySerialize for HandshakePacket<'_>

Source§

fn serialize(&self, buf: &mut Vec<u8>)

Serializes self into the buf.
Source§

impl<'a> PartialEq for HandshakePacket<'a>

Source§

fn eq(&self, other: &HandshakePacket<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Eq for HandshakePacket<'a>

Source§

impl<'a> StructuralPartialEq for HandshakePacket<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for HandshakePacket<'a>

§

impl<'a> RefUnwindSafe for HandshakePacket<'a>

§

impl<'a> Send for HandshakePacket<'a>

§

impl<'a> Sync for HandshakePacket<'a>

§

impl<'a> Unpin for HandshakePacket<'a>

§

impl<'a> UnwindSafe for HandshakePacket<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.