mysql_common/binlog/events/
anonymous_gtid_event.rs1use std::io::{self};
10
11use crate::{
12 binlog::{
13 consts::{BinlogVersion, EventType},
14 BinlogCtx, BinlogEvent, BinlogStruct,
15 },
16 io::ParseBuf,
17 proto::{MyDeserialize, MySerialize},
18};
19
20use super::GtidEvent;
21
22#[repr(transparent)]
24#[derive(Debug, Clone, Eq, PartialEq, Hash)]
25pub struct AnonymousGtidEvent(pub GtidEvent);
26
27impl<'de> MyDeserialize<'de> for AnonymousGtidEvent {
28 const SIZE: Option<usize> = GtidEvent::SIZE;
29 type Ctx = BinlogCtx<'de>;
30
31 fn deserialize(ctx: Self::Ctx, buf: &mut ParseBuf<'de>) -> io::Result<Self> {
32 buf.parse_unchecked(ctx).map(Self)
33 }
34}
35
36impl MySerialize for AnonymousGtidEvent {
37 fn serialize(&self, buf: &mut Vec<u8>) {
38 self.0.serialize(buf)
39 }
40}
41
42impl<'a> BinlogStruct<'a> for AnonymousGtidEvent {
43 fn len(&self, version: BinlogVersion) -> usize {
44 self.0.len(version)
45 }
46}
47
48impl<'a> BinlogEvent<'a> for AnonymousGtidEvent {
49 const EVENT_TYPE: EventType = EventType::ANONYMOUS_GTID_EVENT;
50}