Skip to main content

polyester/gen/buffa/
orderbook.v1.rs

1// @generated by buffa-codegen. DO NOT EDIT.
2
3/// Depth specifies the number of price levels per side.
4#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
5#[repr(i32)]
6pub enum Depth {
7    /// Default depth (50 levels per side).
8    DEPTH_UNSPECIFIED = 0i32,
9    /// 1 level per side (top of book / best bid-ask).
10    DEPTH_1 = 1i32,
11    /// 5 levels per side.
12    DEPTH_5 = 2i32,
13    /// 10 levels per side.
14    DEPTH_10 = 3i32,
15    /// 20 levels per side.
16    DEPTH_20 = 4i32,
17    /// 50 levels per side.
18    DEPTH_50 = 5i32,
19    /// 100 levels per side.
20    DEPTH_100 = 6i32,
21    /// 200 levels per side.
22    DEPTH_200 = 7i32,
23    /// 500 levels per side.
24    DEPTH_500 = 8i32,
25    /// 1000 levels per side.
26    DEPTH_1000 = 9i32,
27}
28impl Depth {
29    ///Idiomatic alias for [`Self::DEPTH_UNSPECIFIED`]; `Debug` prints the variant name.
30    #[allow(non_upper_case_globals)]
31    pub const DepthUnspecified: Self = Self::DEPTH_UNSPECIFIED;
32    ///Idiomatic alias for [`Self::DEPTH_1`]; `Debug` prints the variant name.
33    #[allow(non_upper_case_globals)]
34    pub const Depth1: Self = Self::DEPTH_1;
35    ///Idiomatic alias for [`Self::DEPTH_5`]; `Debug` prints the variant name.
36    #[allow(non_upper_case_globals)]
37    pub const Depth5: Self = Self::DEPTH_5;
38    ///Idiomatic alias for [`Self::DEPTH_10`]; `Debug` prints the variant name.
39    #[allow(non_upper_case_globals)]
40    pub const Depth10: Self = Self::DEPTH_10;
41    ///Idiomatic alias for [`Self::DEPTH_20`]; `Debug` prints the variant name.
42    #[allow(non_upper_case_globals)]
43    pub const Depth20: Self = Self::DEPTH_20;
44    ///Idiomatic alias for [`Self::DEPTH_50`]; `Debug` prints the variant name.
45    #[allow(non_upper_case_globals)]
46    pub const Depth50: Self = Self::DEPTH_50;
47    ///Idiomatic alias for [`Self::DEPTH_100`]; `Debug` prints the variant name.
48    #[allow(non_upper_case_globals)]
49    pub const Depth100: Self = Self::DEPTH_100;
50    ///Idiomatic alias for [`Self::DEPTH_200`]; `Debug` prints the variant name.
51    #[allow(non_upper_case_globals)]
52    pub const Depth200: Self = Self::DEPTH_200;
53    ///Idiomatic alias for [`Self::DEPTH_500`]; `Debug` prints the variant name.
54    #[allow(non_upper_case_globals)]
55    pub const Depth500: Self = Self::DEPTH_500;
56    ///Idiomatic alias for [`Self::DEPTH_1000`]; `Debug` prints the variant name.
57    #[allow(non_upper_case_globals)]
58    pub const Depth1000: Self = Self::DEPTH_1000;
59}
60impl ::core::default::Default for Depth {
61    fn default() -> Self {
62        Self::DEPTH_UNSPECIFIED
63    }
64}
65impl ::serde::Serialize for Depth {
66    fn serialize<S: ::serde::Serializer>(
67        &self,
68        s: S,
69    ) -> ::core::result::Result<S::Ok, S::Error> {
70        s.serialize_str(::buffa::Enumeration::proto_name(self))
71    }
72}
73impl<'de> ::serde::Deserialize<'de> for Depth {
74    fn deserialize<D: ::serde::Deserializer<'de>>(
75        d: D,
76    ) -> ::core::result::Result<Self, D::Error> {
77        struct _V;
78        impl ::serde::de::Visitor<'_> for _V {
79            type Value = Depth;
80            fn expecting(
81                &self,
82                f: &mut ::core::fmt::Formatter<'_>,
83            ) -> ::core::fmt::Result {
84                f.write_str(
85                    concat!("a string, integer, or null for ", stringify!(Depth)),
86                )
87            }
88            fn visit_str<E: ::serde::de::Error>(
89                self,
90                v: &str,
91            ) -> ::core::result::Result<Depth, E> {
92                <Depth as ::buffa::Enumeration>::from_proto_name(v)
93                    .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
94            }
95            fn visit_i64<E: ::serde::de::Error>(
96                self,
97                v: i64,
98            ) -> ::core::result::Result<Depth, E> {
99                let v32 = i32::try_from(v)
100                    .map_err(|_| {
101                        ::serde::de::Error::custom(
102                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
103                        )
104                    })?;
105                <Depth as ::buffa::Enumeration>::from_i32(v32)
106                    .ok_or_else(|| {
107                        ::serde::de::Error::custom(
108                            ::buffa::alloc::format!("unknown enum value {v32}"),
109                        )
110                    })
111            }
112            fn visit_u64<E: ::serde::de::Error>(
113                self,
114                v: u64,
115            ) -> ::core::result::Result<Depth, E> {
116                let v32 = i32::try_from(v)
117                    .map_err(|_| {
118                        ::serde::de::Error::custom(
119                            ::buffa::alloc::format!("enum value {v} out of i32 range"),
120                        )
121                    })?;
122                <Depth as ::buffa::Enumeration>::from_i32(v32)
123                    .ok_or_else(|| {
124                        ::serde::de::Error::custom(
125                            ::buffa::alloc::format!("unknown enum value {v32}"),
126                        )
127                    })
128            }
129            fn visit_unit<E: ::serde::de::Error>(
130                self,
131            ) -> ::core::result::Result<Depth, E> {
132                ::core::result::Result::Ok(::core::default::Default::default())
133            }
134        }
135        d.deserialize_any(_V)
136    }
137}
138impl ::buffa::json_helpers::ProtoElemJson for Depth {
139    fn serialize_proto_json<S: ::serde::Serializer>(
140        v: &Self,
141        s: S,
142    ) -> ::core::result::Result<S::Ok, S::Error> {
143        ::serde::Serialize::serialize(v, s)
144    }
145    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
146        d: D,
147    ) -> ::core::result::Result<Self, D::Error> {
148        <Self as ::serde::Deserialize>::deserialize(d)
149    }
150}
151impl ::buffa::Enumeration for Depth {
152    fn from_i32(value: i32) -> ::core::option::Option<Self> {
153        match value {
154            0i32 => ::core::option::Option::Some(Self::DEPTH_UNSPECIFIED),
155            1i32 => ::core::option::Option::Some(Self::DEPTH_1),
156            2i32 => ::core::option::Option::Some(Self::DEPTH_5),
157            3i32 => ::core::option::Option::Some(Self::DEPTH_10),
158            4i32 => ::core::option::Option::Some(Self::DEPTH_20),
159            5i32 => ::core::option::Option::Some(Self::DEPTH_50),
160            6i32 => ::core::option::Option::Some(Self::DEPTH_100),
161            7i32 => ::core::option::Option::Some(Self::DEPTH_200),
162            8i32 => ::core::option::Option::Some(Self::DEPTH_500),
163            9i32 => ::core::option::Option::Some(Self::DEPTH_1000),
164            _ => ::core::option::Option::None,
165        }
166    }
167    fn to_i32(&self) -> i32 {
168        *self as i32
169    }
170    fn proto_name(&self) -> &'static str {
171        match self {
172            Self::DEPTH_UNSPECIFIED => "DEPTH_UNSPECIFIED",
173            Self::DEPTH_1 => "DEPTH_1",
174            Self::DEPTH_5 => "DEPTH_5",
175            Self::DEPTH_10 => "DEPTH_10",
176            Self::DEPTH_20 => "DEPTH_20",
177            Self::DEPTH_50 => "DEPTH_50",
178            Self::DEPTH_100 => "DEPTH_100",
179            Self::DEPTH_200 => "DEPTH_200",
180            Self::DEPTH_500 => "DEPTH_500",
181            Self::DEPTH_1000 => "DEPTH_1000",
182        }
183    }
184    fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
185        match name {
186            "DEPTH_UNSPECIFIED" => ::core::option::Option::Some(Self::DEPTH_UNSPECIFIED),
187            "DEPTH_1" => ::core::option::Option::Some(Self::DEPTH_1),
188            "DEPTH_5" => ::core::option::Option::Some(Self::DEPTH_5),
189            "DEPTH_10" => ::core::option::Option::Some(Self::DEPTH_10),
190            "DEPTH_20" => ::core::option::Option::Some(Self::DEPTH_20),
191            "DEPTH_50" => ::core::option::Option::Some(Self::DEPTH_50),
192            "DEPTH_100" => ::core::option::Option::Some(Self::DEPTH_100),
193            "DEPTH_200" => ::core::option::Option::Some(Self::DEPTH_200),
194            "DEPTH_500" => ::core::option::Option::Some(Self::DEPTH_500),
195            "DEPTH_1000" => ::core::option::Option::Some(Self::DEPTH_1000),
196            _ => ::core::option::Option::None,
197        }
198    }
199    fn values() -> &'static [Self] {
200        &[
201            Self::DEPTH_UNSPECIFIED,
202            Self::DEPTH_1,
203            Self::DEPTH_5,
204            Self::DEPTH_10,
205            Self::DEPTH_20,
206            Self::DEPTH_50,
207            Self::DEPTH_100,
208            Self::DEPTH_200,
209            Self::DEPTH_500,
210            Self::DEPTH_1000,
211        ]
212    }
213}
214/// GetOrderBookRequest describes a snapshot view request.
215#[derive(Clone, PartialEq, Default)]
216#[derive(::serde::Serialize, ::serde::Deserialize)]
217#[serde(default)]
218pub struct GetOrderBookRequest {
219    /// e.g. "BTC-USDT"; resolved to symbol_id server-side.
220    ///
221    /// Field 1: `symbol`
222    #[serde(
223        rename = "symbol",
224        with = "::buffa::json_helpers::proto_string",
225        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
226    )]
227    pub symbol: ::buffa::alloc::string::String,
228    /// Requested depth per side (number of price levels). Default is 50.
229    ///
230    /// Field 2: `depth`
231    #[serde(
232        rename = "depth",
233        with = "::buffa::json_helpers::proto_enum",
234        skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
235    )]
236    pub depth: ::buffa::EnumValue<Depth>,
237    #[serde(skip)]
238    #[doc(hidden)]
239    pub __buffa_unknown_fields: ::buffa::UnknownFields,
240}
241impl ::core::fmt::Debug for GetOrderBookRequest {
242    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
243        f.debug_struct("GetOrderBookRequest")
244            .field("symbol", &self.symbol)
245            .field("depth", &self.depth)
246            .finish()
247    }
248}
249impl GetOrderBookRequest {
250    /// Protobuf type URL for this message, for use with `Any::pack` and
251    /// `Any::unpack_if`.
252    ///
253    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
254    pub const TYPE_URL: &'static str = "type.googleapis.com/orderbook.v1.GetOrderBookRequest";
255}
256::buffa::impl_default_instance!(GetOrderBookRequest);
257impl ::buffa::MessageName for GetOrderBookRequest {
258    const PACKAGE: &'static str = "orderbook.v1";
259    const NAME: &'static str = "GetOrderBookRequest";
260    const FULL_NAME: &'static str = "orderbook.v1.GetOrderBookRequest";
261    const TYPE_URL: &'static str = "type.googleapis.com/orderbook.v1.GetOrderBookRequest";
262}
263impl ::buffa::Message for GetOrderBookRequest {
264    /// Returns the total encoded size in bytes.
265    ///
266    /// The result is a `u32`; the protobuf specification requires all
267    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
268    /// compliant message will never overflow this type.
269    #[allow(clippy::let_and_return)]
270    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
271        #[allow(unused_imports)]
272        use ::buffa::Enumeration as _;
273        let mut size = 0u32;
274        if !self.symbol.is_empty() {
275            size += 1u32 + ::buffa::types::string_encoded_len(&self.symbol) as u32;
276        }
277        {
278            let val = self.depth.to_i32();
279            if val != 0 {
280                size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
281            }
282        }
283        size += self.__buffa_unknown_fields.encoded_len() as u32;
284        size
285    }
286    fn write_to(
287        &self,
288        _cache: &mut ::buffa::SizeCache,
289        buf: &mut impl ::buffa::bytes::BufMut,
290    ) {
291        #[allow(unused_imports)]
292        use ::buffa::Enumeration as _;
293        if !self.symbol.is_empty() {
294            ::buffa::types::put_string_field(1u32, &self.symbol, buf);
295        }
296        {
297            let val = self.depth.to_i32();
298            if val != 0 {
299                ::buffa::types::put_int32_field(2u32, val, buf);
300            }
301        }
302        self.__buffa_unknown_fields.write_to(buf);
303    }
304    fn merge_field(
305        &mut self,
306        tag: ::buffa::encoding::Tag,
307        buf: &mut impl ::buffa::bytes::Buf,
308        ctx: ::buffa::DecodeContext<'_>,
309    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
310        #[allow(unused_imports)]
311        use ::buffa::bytes::Buf as _;
312        #[allow(unused_imports)]
313        use ::buffa::Enumeration as _;
314        match tag.field_number() {
315            1u32 => {
316                ::buffa::encoding::check_wire_type(
317                    tag,
318                    ::buffa::encoding::WireType::LengthDelimited,
319                )?;
320                ::buffa::types::merge_string(&mut self.symbol, buf)?;
321            }
322            2u32 => {
323                ::buffa::encoding::check_wire_type(
324                    tag,
325                    ::buffa::encoding::WireType::Varint,
326                )?;
327                self.depth = ::buffa::EnumValue::from(
328                    ::buffa::types::decode_int32(buf)?,
329                );
330            }
331            _ => {
332                self.__buffa_unknown_fields
333                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
334            }
335        }
336        ::core::result::Result::Ok(())
337    }
338    fn clear(&mut self) {
339        self.symbol.clear();
340        self.depth = ::buffa::EnumValue::from(0);
341        self.__buffa_unknown_fields.clear();
342    }
343}
344impl ::buffa::ExtensionSet for GetOrderBookRequest {
345    const PROTO_FQN: &'static str = "orderbook.v1.GetOrderBookRequest";
346    fn unknown_fields(&self) -> &::buffa::UnknownFields {
347        &self.__buffa_unknown_fields
348    }
349    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
350        &mut self.__buffa_unknown_fields
351    }
352}
353impl ::buffa::json_helpers::ProtoElemJson for GetOrderBookRequest {
354    fn serialize_proto_json<S: ::serde::Serializer>(
355        v: &Self,
356        s: S,
357    ) -> ::core::result::Result<S::Ok, S::Error> {
358        ::serde::Serialize::serialize(v, s)
359    }
360    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
361        d: D,
362    ) -> ::core::result::Result<Self, D::Error> {
363        <Self as ::serde::Deserialize>::deserialize(d)
364    }
365}
366#[doc(hidden)]
367pub const __GET_ORDER_BOOK_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
368    type_url: "type.googleapis.com/orderbook.v1.GetOrderBookRequest",
369    to_json: ::buffa::type_registry::any_to_json::<GetOrderBookRequest>,
370    from_json: ::buffa::type_registry::any_from_json::<GetOrderBookRequest>,
371    is_wkt: false,
372};
373/// PriceLevel uses scaled integers for the binary (protobuf) API (low-latency).
374/// REST surfaces expose decimal strings via DTO conversion.
375#[derive(Clone, PartialEq, Default)]
376#[derive(::serde::Serialize, ::serde::Deserialize)]
377#[serde(default)]
378pub struct PriceLevel {
379    /// Price in quote units scaled by 1e6.
380    ///
381    /// Field 1: `price_ticks`
382    #[serde(
383        rename = "priceTicks",
384        alias = "price_ticks",
385        with = "::buffa::json_helpers::int64",
386        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
387    )]
388    pub price_ticks: i64,
389    /// Quantity scaled by the pair's base_quantity_scale from GetSpotConfig.
390    ///
391    /// Field 2: `qty_scaled`
392    #[serde(
393        rename = "qtyScaled",
394        alias = "qty_scaled",
395        with = "::buffa::json_helpers::int64",
396        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_i64"
397    )]
398    pub qty_scaled: i64,
399    #[serde(skip)]
400    #[doc(hidden)]
401    pub __buffa_unknown_fields: ::buffa::UnknownFields,
402}
403impl ::core::fmt::Debug for PriceLevel {
404    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
405        f.debug_struct("PriceLevel")
406            .field("price_ticks", &self.price_ticks)
407            .field("qty_scaled", &self.qty_scaled)
408            .finish()
409    }
410}
411impl PriceLevel {
412    /// Protobuf type URL for this message, for use with `Any::pack` and
413    /// `Any::unpack_if`.
414    ///
415    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
416    pub const TYPE_URL: &'static str = "type.googleapis.com/orderbook.v1.PriceLevel";
417}
418::buffa::impl_default_instance!(PriceLevel);
419impl ::buffa::MessageName for PriceLevel {
420    const PACKAGE: &'static str = "orderbook.v1";
421    const NAME: &'static str = "PriceLevel";
422    const FULL_NAME: &'static str = "orderbook.v1.PriceLevel";
423    const TYPE_URL: &'static str = "type.googleapis.com/orderbook.v1.PriceLevel";
424}
425impl ::buffa::Message for PriceLevel {
426    /// Returns the total encoded size in bytes.
427    ///
428    /// The result is a `u32`; the protobuf specification requires all
429    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
430    /// compliant message will never overflow this type.
431    #[allow(clippy::let_and_return)]
432    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
433        #[allow(unused_imports)]
434        use ::buffa::Enumeration as _;
435        let mut size = 0u32;
436        if self.price_ticks != 0i64 {
437            size += 1u32 + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
438        }
439        if self.qty_scaled != 0i64 {
440            size += 1u32 + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
441        }
442        size += self.__buffa_unknown_fields.encoded_len() as u32;
443        size
444    }
445    fn write_to(
446        &self,
447        _cache: &mut ::buffa::SizeCache,
448        buf: &mut impl ::buffa::bytes::BufMut,
449    ) {
450        #[allow(unused_imports)]
451        use ::buffa::Enumeration as _;
452        if self.price_ticks != 0i64 {
453            ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
454        }
455        if self.qty_scaled != 0i64 {
456            ::buffa::types::put_int64_field(2u32, self.qty_scaled, buf);
457        }
458        self.__buffa_unknown_fields.write_to(buf);
459    }
460    fn merge_field(
461        &mut self,
462        tag: ::buffa::encoding::Tag,
463        buf: &mut impl ::buffa::bytes::Buf,
464        ctx: ::buffa::DecodeContext<'_>,
465    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
466        #[allow(unused_imports)]
467        use ::buffa::bytes::Buf as _;
468        #[allow(unused_imports)]
469        use ::buffa::Enumeration as _;
470        match tag.field_number() {
471            1u32 => {
472                ::buffa::encoding::check_wire_type(
473                    tag,
474                    ::buffa::encoding::WireType::Varint,
475                )?;
476                self.price_ticks = ::buffa::types::decode_int64(buf)?;
477            }
478            2u32 => {
479                ::buffa::encoding::check_wire_type(
480                    tag,
481                    ::buffa::encoding::WireType::Varint,
482                )?;
483                self.qty_scaled = ::buffa::types::decode_int64(buf)?;
484            }
485            _ => {
486                self.__buffa_unknown_fields
487                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
488            }
489        }
490        ::core::result::Result::Ok(())
491    }
492    fn clear(&mut self) {
493        self.price_ticks = 0i64;
494        self.qty_scaled = 0i64;
495        self.__buffa_unknown_fields.clear();
496    }
497}
498impl ::buffa::ExtensionSet for PriceLevel {
499    const PROTO_FQN: &'static str = "orderbook.v1.PriceLevel";
500    fn unknown_fields(&self) -> &::buffa::UnknownFields {
501        &self.__buffa_unknown_fields
502    }
503    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
504        &mut self.__buffa_unknown_fields
505    }
506}
507impl ::buffa::json_helpers::ProtoElemJson for PriceLevel {
508    fn serialize_proto_json<S: ::serde::Serializer>(
509        v: &Self,
510        s: S,
511    ) -> ::core::result::Result<S::Ok, S::Error> {
512        ::serde::Serialize::serialize(v, s)
513    }
514    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
515        d: D,
516    ) -> ::core::result::Result<Self, D::Error> {
517        <Self as ::serde::Deserialize>::deserialize(d)
518    }
519}
520#[doc(hidden)]
521pub const __PRICE_LEVEL_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
522    type_url: "type.googleapis.com/orderbook.v1.PriceLevel",
523    to_json: ::buffa::type_registry::any_to_json::<PriceLevel>,
524    from_json: ::buffa::type_registry::any_from_json::<PriceLevel>,
525    is_wkt: false,
526};
527/// GetOrderBookResponse is a depth snapshot for the binary (protobuf) API (scaled integers).
528/// REST surfaces expose decimal strings via DTO conversion.
529#[derive(Clone, PartialEq, Default)]
530#[derive(::serde::Serialize, ::serde::Deserialize)]
531#[serde(default)]
532pub struct GetOrderBookResponse {
533    /// Numeric symbol identifier (client resolves to symbol string).
534    ///
535    /// Field 1: `symbol_id`
536    #[serde(
537        rename = "symbolId",
538        alias = "symbol_id",
539        with = "::buffa::json_helpers::uint32",
540        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
541    )]
542    pub symbol_id: u32,
543    /// Monotonic book sequence for this symbol.
544    ///
545    /// Field 2: `book_seq`
546    #[serde(
547        rename = "bookSeq",
548        alias = "book_seq",
549        with = "::buffa::json_helpers::uint64",
550        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
551    )]
552    pub book_seq: u64,
553    /// Best bid first; descending price.
554    ///
555    /// Field 3: `bids`
556    #[serde(
557        rename = "bids",
558        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
559        deserialize_with = "::buffa::json_helpers::null_as_default"
560    )]
561    pub bids: ::buffa::alloc::vec::Vec<PriceLevel>,
562    /// Best ask first; ascending price.
563    ///
564    /// Field 4: `asks`
565    #[serde(
566        rename = "asks",
567        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
568        deserialize_with = "::buffa::json_helpers::null_as_default"
569    )]
570    pub asks: ::buffa::alloc::vec::Vec<PriceLevel>,
571    /// Timestamp associated with this snapshot (best-effort).
572    ///
573    /// Field 5: `ts`
574    #[serde(
575        rename = "ts",
576        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
577    )]
578    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
579    #[serde(skip)]
580    #[doc(hidden)]
581    pub __buffa_unknown_fields: ::buffa::UnknownFields,
582}
583impl ::core::fmt::Debug for GetOrderBookResponse {
584    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
585        f.debug_struct("GetOrderBookResponse")
586            .field("symbol_id", &self.symbol_id)
587            .field("book_seq", &self.book_seq)
588            .field("bids", &self.bids)
589            .field("asks", &self.asks)
590            .field("ts", &self.ts)
591            .finish()
592    }
593}
594impl GetOrderBookResponse {
595    /// Protobuf type URL for this message, for use with `Any::pack` and
596    /// `Any::unpack_if`.
597    ///
598    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
599    pub const TYPE_URL: &'static str = "type.googleapis.com/orderbook.v1.GetOrderBookResponse";
600}
601::buffa::impl_default_instance!(GetOrderBookResponse);
602impl ::buffa::MessageName for GetOrderBookResponse {
603    const PACKAGE: &'static str = "orderbook.v1";
604    const NAME: &'static str = "GetOrderBookResponse";
605    const FULL_NAME: &'static str = "orderbook.v1.GetOrderBookResponse";
606    const TYPE_URL: &'static str = "type.googleapis.com/orderbook.v1.GetOrderBookResponse";
607}
608impl ::buffa::Message for GetOrderBookResponse {
609    /// Returns the total encoded size in bytes.
610    ///
611    /// The result is a `u32`; the protobuf specification requires all
612    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
613    /// compliant message will never overflow this type.
614    #[allow(clippy::let_and_return)]
615    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
616        #[allow(unused_imports)]
617        use ::buffa::Enumeration as _;
618        let mut size = 0u32;
619        if self.symbol_id != 0u32 {
620            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
621        }
622        if self.book_seq != 0u64 {
623            size += 1u32 + ::buffa::types::uint64_encoded_len(self.book_seq) as u32;
624        }
625        for v in &self.bids {
626            let __slot = __cache.reserve();
627            let inner_size = v.compute_size(__cache);
628            __cache.set(__slot, inner_size);
629            size
630                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
631                    + inner_size;
632        }
633        for v in &self.asks {
634            let __slot = __cache.reserve();
635            let inner_size = v.compute_size(__cache);
636            __cache.set(__slot, inner_size);
637            size
638                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
639                    + inner_size;
640        }
641        if self.ts.is_set() {
642            let __slot = __cache.reserve();
643            let inner_size = self.ts.compute_size(__cache);
644            __cache.set(__slot, inner_size);
645            size
646                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
647                    + inner_size;
648        }
649        size += self.__buffa_unknown_fields.encoded_len() as u32;
650        size
651    }
652    fn write_to(
653        &self,
654        __cache: &mut ::buffa::SizeCache,
655        buf: &mut impl ::buffa::bytes::BufMut,
656    ) {
657        #[allow(unused_imports)]
658        use ::buffa::Enumeration as _;
659        if self.symbol_id != 0u32 {
660            ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
661        }
662        if self.book_seq != 0u64 {
663            ::buffa::types::put_uint64_field(2u32, self.book_seq, buf);
664        }
665        for v in &self.bids {
666            ::buffa::types::put_len_delimited_header(3u32, __cache.consume_next(), buf);
667            v.write_to(__cache, buf);
668        }
669        for v in &self.asks {
670            ::buffa::types::put_len_delimited_header(4u32, __cache.consume_next(), buf);
671            v.write_to(__cache, buf);
672        }
673        if self.ts.is_set() {
674            ::buffa::types::put_len_delimited_header(5u32, __cache.consume_next(), buf);
675            self.ts.write_to(__cache, buf);
676        }
677        self.__buffa_unknown_fields.write_to(buf);
678    }
679    fn merge_field(
680        &mut self,
681        tag: ::buffa::encoding::Tag,
682        buf: &mut impl ::buffa::bytes::Buf,
683        ctx: ::buffa::DecodeContext<'_>,
684    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
685        #[allow(unused_imports)]
686        use ::buffa::bytes::Buf as _;
687        #[allow(unused_imports)]
688        use ::buffa::Enumeration as _;
689        match tag.field_number() {
690            1u32 => {
691                ::buffa::encoding::check_wire_type(
692                    tag,
693                    ::buffa::encoding::WireType::Varint,
694                )?;
695                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
696            }
697            2u32 => {
698                ::buffa::encoding::check_wire_type(
699                    tag,
700                    ::buffa::encoding::WireType::Varint,
701                )?;
702                self.book_seq = ::buffa::types::decode_uint64(buf)?;
703            }
704            3u32 => {
705                ::buffa::encoding::check_wire_type(
706                    tag,
707                    ::buffa::encoding::WireType::LengthDelimited,
708                )?;
709                let mut elem = ::core::default::Default::default();
710                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
711                self.bids.push(elem);
712            }
713            4u32 => {
714                ::buffa::encoding::check_wire_type(
715                    tag,
716                    ::buffa::encoding::WireType::LengthDelimited,
717                )?;
718                let mut elem = ::core::default::Default::default();
719                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
720                self.asks.push(elem);
721            }
722            5u32 => {
723                ::buffa::encoding::check_wire_type(
724                    tag,
725                    ::buffa::encoding::WireType::LengthDelimited,
726                )?;
727                ::buffa::Message::merge_length_delimited(
728                    self.ts.get_or_insert_default(),
729                    buf,
730                    ctx,
731                )?;
732            }
733            _ => {
734                self.__buffa_unknown_fields
735                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
736            }
737        }
738        ::core::result::Result::Ok(())
739    }
740    fn clear(&mut self) {
741        self.symbol_id = 0u32;
742        self.book_seq = 0u64;
743        self.bids.clear();
744        self.asks.clear();
745        self.ts = ::buffa::MessageField::none();
746        self.__buffa_unknown_fields.clear();
747    }
748}
749impl ::buffa::ExtensionSet for GetOrderBookResponse {
750    const PROTO_FQN: &'static str = "orderbook.v1.GetOrderBookResponse";
751    fn unknown_fields(&self) -> &::buffa::UnknownFields {
752        &self.__buffa_unknown_fields
753    }
754    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
755        &mut self.__buffa_unknown_fields
756    }
757}
758impl ::buffa::json_helpers::ProtoElemJson for GetOrderBookResponse {
759    fn serialize_proto_json<S: ::serde::Serializer>(
760        v: &Self,
761        s: S,
762    ) -> ::core::result::Result<S::Ok, S::Error> {
763        ::serde::Serialize::serialize(v, s)
764    }
765    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
766        d: D,
767    ) -> ::core::result::Result<Self, D::Error> {
768        <Self as ::serde::Deserialize>::deserialize(d)
769    }
770}
771#[doc(hidden)]
772pub const __GET_ORDER_BOOK_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
773    type_url: "type.googleapis.com/orderbook.v1.GetOrderBookResponse",
774    to_json: ::buffa::type_registry::any_to_json::<GetOrderBookResponse>,
775    from_json: ::buffa::type_registry::any_from_json::<GetOrderBookResponse>,
776    is_wkt: false,
777};
778/// OrderBookDelta is an incremental update to the orderbook state.
779/// Uses scaled integers (binary protobuf) for realtime streaming performance.
780///
781/// Semantics:
782/// - For each side, each \[price_ticks\] entry is a SET at that price:
783///   - qty_scaled \> 0 =\> set/replace that level quantity
784///   - qty_scaled == 0 =\> delete that level
785/// - reset=true indicates the book should be cleared before applying any levels.
786///
787/// Clients are expected to initialize from GetOrderBook (snapshot) and then
788/// apply deltas in order. If a gap is detected, clients should refetch a
789/// snapshot.
790#[derive(Clone, PartialEq, Default)]
791#[derive(::serde::Serialize, ::serde::Deserialize)]
792#[serde(default)]
793pub struct OrderBookDelta {
794    /// Numeric symbol identifier.
795    ///
796    /// Field 1: `symbol_id`
797    #[serde(
798        rename = "symbolId",
799        alias = "symbol_id",
800        with = "::buffa::json_helpers::uint32",
801        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u32"
802    )]
803    pub symbol_id: u32,
804    /// Monotonic book sequence range covered by this update.
805    /// When reset=true, book_seq_start may be 0.
806    ///
807    /// Field 2: `book_seq_start`
808    #[serde(
809        rename = "bookSeqStart",
810        alias = "book_seq_start",
811        with = "::buffa::json_helpers::uint64",
812        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
813    )]
814    pub book_seq_start: u64,
815    /// Monotonic book sequence at the end of this update's range. Consumers can
816    /// retain it as the last applied sequence and ignore updates that do not advance it.
817    ///
818    /// Field 3: `book_seq_end`
819    #[serde(
820        rename = "bookSeqEnd",
821        alias = "book_seq_end",
822        with = "::buffa::json_helpers::uint64",
823        skip_serializing_if = "::buffa::json_helpers::skip_if::is_zero_u64"
824    )]
825    pub book_seq_end: u64,
826    /// Bid-side updates (SET semantics at price_ticks).
827    ///
828    /// Field 4: `bids`
829    #[serde(
830        rename = "bids",
831        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
832        deserialize_with = "::buffa::json_helpers::null_as_default"
833    )]
834    pub bids: ::buffa::alloc::vec::Vec<PriceLevel>,
835    /// Ask-side updates (SET semantics at price_ticks).
836    ///
837    /// Field 5: `asks`
838    #[serde(
839        rename = "asks",
840        skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
841        deserialize_with = "::buffa::json_helpers::null_as_default"
842    )]
843    pub asks: ::buffa::alloc::vec::Vec<PriceLevel>,
844    /// If true, consumers should clear their local book state before applying
845    /// updates.
846    ///
847    /// Field 6: `reset`
848    #[serde(
849        rename = "reset",
850        with = "::buffa::json_helpers::proto_bool",
851        skip_serializing_if = "::buffa::json_helpers::skip_if::is_false"
852    )]
853    pub reset: bool,
854    /// Timestamp associated with this update (best-effort).
855    ///
856    /// Field 7: `ts`
857    #[serde(
858        rename = "ts",
859        skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
860    )]
861    pub ts: ::buffa::MessageField<::buffa_types::google::protobuf::Timestamp>,
862    #[serde(skip)]
863    #[doc(hidden)]
864    pub __buffa_unknown_fields: ::buffa::UnknownFields,
865}
866impl ::core::fmt::Debug for OrderBookDelta {
867    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
868        f.debug_struct("OrderBookDelta")
869            .field("symbol_id", &self.symbol_id)
870            .field("book_seq_start", &self.book_seq_start)
871            .field("book_seq_end", &self.book_seq_end)
872            .field("bids", &self.bids)
873            .field("asks", &self.asks)
874            .field("reset", &self.reset)
875            .field("ts", &self.ts)
876            .finish()
877    }
878}
879impl OrderBookDelta {
880    /// Protobuf type URL for this message, for use with `Any::pack` and
881    /// `Any::unpack_if`.
882    ///
883    /// Format: `type.googleapis.com/<fully.qualified.TypeName>`
884    pub const TYPE_URL: &'static str = "type.googleapis.com/orderbook.v1.OrderBookDelta";
885}
886::buffa::impl_default_instance!(OrderBookDelta);
887impl ::buffa::MessageName for OrderBookDelta {
888    const PACKAGE: &'static str = "orderbook.v1";
889    const NAME: &'static str = "OrderBookDelta";
890    const FULL_NAME: &'static str = "orderbook.v1.OrderBookDelta";
891    const TYPE_URL: &'static str = "type.googleapis.com/orderbook.v1.OrderBookDelta";
892}
893impl ::buffa::Message for OrderBookDelta {
894    /// Returns the total encoded size in bytes.
895    ///
896    /// The result is a `u32`; the protobuf specification requires all
897    /// messages to fit within 2 GiB (2,147,483,647 bytes), so a
898    /// compliant message will never overflow this type.
899    #[allow(clippy::let_and_return)]
900    fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
901        #[allow(unused_imports)]
902        use ::buffa::Enumeration as _;
903        let mut size = 0u32;
904        if self.symbol_id != 0u32 {
905            size += 1u32 + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
906        }
907        if self.book_seq_start != 0u64 {
908            size
909                += 1u32 + ::buffa::types::uint64_encoded_len(self.book_seq_start) as u32;
910        }
911        if self.book_seq_end != 0u64 {
912            size += 1u32 + ::buffa::types::uint64_encoded_len(self.book_seq_end) as u32;
913        }
914        for v in &self.bids {
915            let __slot = __cache.reserve();
916            let inner_size = v.compute_size(__cache);
917            __cache.set(__slot, inner_size);
918            size
919                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
920                    + inner_size;
921        }
922        for v in &self.asks {
923            let __slot = __cache.reserve();
924            let inner_size = v.compute_size(__cache);
925            __cache.set(__slot, inner_size);
926            size
927                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
928                    + inner_size;
929        }
930        if self.reset {
931            size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
932        }
933        if self.ts.is_set() {
934            let __slot = __cache.reserve();
935            let inner_size = self.ts.compute_size(__cache);
936            __cache.set(__slot, inner_size);
937            size
938                += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
939                    + inner_size;
940        }
941        size += self.__buffa_unknown_fields.encoded_len() as u32;
942        size
943    }
944    fn write_to(
945        &self,
946        __cache: &mut ::buffa::SizeCache,
947        buf: &mut impl ::buffa::bytes::BufMut,
948    ) {
949        #[allow(unused_imports)]
950        use ::buffa::Enumeration as _;
951        if self.symbol_id != 0u32 {
952            ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
953        }
954        if self.book_seq_start != 0u64 {
955            ::buffa::types::put_uint64_field(2u32, self.book_seq_start, buf);
956        }
957        if self.book_seq_end != 0u64 {
958            ::buffa::types::put_uint64_field(3u32, self.book_seq_end, buf);
959        }
960        for v in &self.bids {
961            ::buffa::types::put_len_delimited_header(4u32, __cache.consume_next(), buf);
962            v.write_to(__cache, buf);
963        }
964        for v in &self.asks {
965            ::buffa::types::put_len_delimited_header(5u32, __cache.consume_next(), buf);
966            v.write_to(__cache, buf);
967        }
968        if self.reset {
969            ::buffa::types::put_bool_field(6u32, self.reset, buf);
970        }
971        if self.ts.is_set() {
972            ::buffa::types::put_len_delimited_header(7u32, __cache.consume_next(), buf);
973            self.ts.write_to(__cache, buf);
974        }
975        self.__buffa_unknown_fields.write_to(buf);
976    }
977    fn merge_field(
978        &mut self,
979        tag: ::buffa::encoding::Tag,
980        buf: &mut impl ::buffa::bytes::Buf,
981        ctx: ::buffa::DecodeContext<'_>,
982    ) -> ::core::result::Result<(), ::buffa::DecodeError> {
983        #[allow(unused_imports)]
984        use ::buffa::bytes::Buf as _;
985        #[allow(unused_imports)]
986        use ::buffa::Enumeration as _;
987        match tag.field_number() {
988            1u32 => {
989                ::buffa::encoding::check_wire_type(
990                    tag,
991                    ::buffa::encoding::WireType::Varint,
992                )?;
993                self.symbol_id = ::buffa::types::decode_uint32(buf)?;
994            }
995            2u32 => {
996                ::buffa::encoding::check_wire_type(
997                    tag,
998                    ::buffa::encoding::WireType::Varint,
999                )?;
1000                self.book_seq_start = ::buffa::types::decode_uint64(buf)?;
1001            }
1002            3u32 => {
1003                ::buffa::encoding::check_wire_type(
1004                    tag,
1005                    ::buffa::encoding::WireType::Varint,
1006                )?;
1007                self.book_seq_end = ::buffa::types::decode_uint64(buf)?;
1008            }
1009            4u32 => {
1010                ::buffa::encoding::check_wire_type(
1011                    tag,
1012                    ::buffa::encoding::WireType::LengthDelimited,
1013                )?;
1014                let mut elem = ::core::default::Default::default();
1015                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
1016                self.bids.push(elem);
1017            }
1018            5u32 => {
1019                ::buffa::encoding::check_wire_type(
1020                    tag,
1021                    ::buffa::encoding::WireType::LengthDelimited,
1022                )?;
1023                let mut elem = ::core::default::Default::default();
1024                ::buffa::Message::merge_length_delimited(&mut elem, buf, ctx)?;
1025                self.asks.push(elem);
1026            }
1027            6u32 => {
1028                ::buffa::encoding::check_wire_type(
1029                    tag,
1030                    ::buffa::encoding::WireType::Varint,
1031                )?;
1032                self.reset = ::buffa::types::decode_bool(buf)?;
1033            }
1034            7u32 => {
1035                ::buffa::encoding::check_wire_type(
1036                    tag,
1037                    ::buffa::encoding::WireType::LengthDelimited,
1038                )?;
1039                ::buffa::Message::merge_length_delimited(
1040                    self.ts.get_or_insert_default(),
1041                    buf,
1042                    ctx,
1043                )?;
1044            }
1045            _ => {
1046                self.__buffa_unknown_fields
1047                    .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
1048            }
1049        }
1050        ::core::result::Result::Ok(())
1051    }
1052    fn clear(&mut self) {
1053        self.symbol_id = 0u32;
1054        self.book_seq_start = 0u64;
1055        self.book_seq_end = 0u64;
1056        self.bids.clear();
1057        self.asks.clear();
1058        self.reset = false;
1059        self.ts = ::buffa::MessageField::none();
1060        self.__buffa_unknown_fields.clear();
1061    }
1062}
1063impl ::buffa::ExtensionSet for OrderBookDelta {
1064    const PROTO_FQN: &'static str = "orderbook.v1.OrderBookDelta";
1065    fn unknown_fields(&self) -> &::buffa::UnknownFields {
1066        &self.__buffa_unknown_fields
1067    }
1068    fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1069        &mut self.__buffa_unknown_fields
1070    }
1071}
1072impl ::buffa::json_helpers::ProtoElemJson for OrderBookDelta {
1073    fn serialize_proto_json<S: ::serde::Serializer>(
1074        v: &Self,
1075        s: S,
1076    ) -> ::core::result::Result<S::Ok, S::Error> {
1077        ::serde::Serialize::serialize(v, s)
1078    }
1079    fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1080        d: D,
1081    ) -> ::core::result::Result<Self, D::Error> {
1082        <Self as ::serde::Deserialize>::deserialize(d)
1083    }
1084}
1085#[doc(hidden)]
1086pub const __ORDER_BOOK_DELTA_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1087    type_url: "type.googleapis.com/orderbook.v1.OrderBookDelta",
1088    to_json: ::buffa::type_registry::any_to_json::<OrderBookDelta>,
1089    from_json: ::buffa::type_registry::any_from_json::<OrderBookDelta>,
1090    is_wkt: false,
1091};
1092#[allow(
1093    non_camel_case_types,
1094    dead_code,
1095    unused_imports,
1096    unused_qualifications,
1097    clippy::derivable_impls,
1098    clippy::match_single_binding,
1099    clippy::uninlined_format_args,
1100    clippy::doc_lazy_continuation,
1101    clippy::module_inception
1102)]
1103pub mod __buffa {
1104    #[allow(unused_imports)]
1105    use super::*;
1106    pub mod view {
1107        #[allow(unused_imports)]
1108        use super::*;
1109        /// GetOrderBookRequest describes a snapshot view request.
1110        #[derive(Clone, Debug, Default)]
1111        pub struct GetOrderBookRequestView<'a> {
1112            /// e.g. "BTC-USDT"; resolved to symbol_id server-side.
1113            ///
1114            /// Field 1: `symbol`
1115            pub symbol: &'a str,
1116            /// Requested depth per side (number of price levels). Default is 50.
1117            ///
1118            /// Field 2: `depth`
1119            pub depth: ::buffa::EnumValue<super::super::Depth>,
1120            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1121        }
1122        impl<'a> ::buffa::MessageView<'a> for GetOrderBookRequestView<'a> {
1123            type Owned = super::super::GetOrderBookRequest;
1124            fn decode_view(
1125                buf: &'a [u8],
1126            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1127                let __limit = ::core::cell::Cell::new(
1128                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
1129                );
1130                <Self as ::buffa::MessageView>::decode_view_ctx(
1131                    buf,
1132                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
1133                )
1134            }
1135            fn decode_view_with_ctx(
1136                buf: &'a [u8],
1137                ctx: ::buffa::DecodeContext<'_>,
1138            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1139                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
1140            }
1141            fn merge_view_field(
1142                &mut self,
1143                tag: ::buffa::encoding::Tag,
1144                cur: &'a [u8],
1145                before_tag: &'a [u8],
1146                ctx: ::buffa::DecodeContext<'_>,
1147            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
1148                let _ = ctx;
1149                #[allow(unused_variables)]
1150                let view = self;
1151                let mut cur = cur;
1152                match tag.field_number() {
1153                    1u32 => {
1154                        ::buffa::encoding::check_wire_type(
1155                            tag,
1156                            ::buffa::encoding::WireType::LengthDelimited,
1157                        )?;
1158                        view.symbol = ::buffa::types::borrow_str(&mut cur)?;
1159                    }
1160                    2u32 => {
1161                        ::buffa::encoding::check_wire_type(
1162                            tag,
1163                            ::buffa::encoding::WireType::Varint,
1164                        )?;
1165                        view.depth = ::buffa::EnumValue::from(
1166                            ::buffa::types::decode_int32(&mut cur)?,
1167                        );
1168                    }
1169                    _ => {
1170                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
1171                        let span_len = before_tag.len() - cur.len();
1172                        view.__buffa_unknown_fields
1173                            .push_record(before_tag, span_len, ctx)?;
1174                    }
1175                }
1176                ::core::result::Result::Ok(cur)
1177            }
1178            fn to_owned_message(
1179                &self,
1180            ) -> ::core::result::Result<
1181                super::super::GetOrderBookRequest,
1182                ::buffa::DecodeError,
1183            > {
1184                self.to_owned_from_source(None)
1185            }
1186            #[allow(clippy::useless_conversion, clippy::needless_update)]
1187            fn to_owned_from_source(
1188                &self,
1189                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1190            ) -> ::core::result::Result<
1191                super::super::GetOrderBookRequest,
1192                ::buffa::DecodeError,
1193            > {
1194                #[allow(unused_imports)]
1195                use ::buffa::alloc::string::ToString as _;
1196                let _ = __buffa_src;
1197                ::core::result::Result::Ok(super::super::GetOrderBookRequest {
1198                    symbol: self.symbol.to_string(),
1199                    depth: self.depth,
1200                    __buffa_unknown_fields: self
1201                        .__buffa_unknown_fields
1202                        .to_owned()?
1203                        .into(),
1204                    ..::core::default::Default::default()
1205                })
1206            }
1207        }
1208        impl<'a> ::buffa::ViewEncode<'a> for GetOrderBookRequestView<'a> {
1209            #[allow(clippy::needless_borrow, clippy::let_and_return)]
1210            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1211                #[allow(unused_imports)]
1212                use ::buffa::Enumeration as _;
1213                let mut size = 0u32;
1214                if !self.symbol.is_empty() {
1215                    size
1216                        += 1u32
1217                            + ::buffa::types::string_encoded_len(&self.symbol) as u32;
1218                }
1219                {
1220                    let val = self.depth.to_i32();
1221                    if val != 0 {
1222                        size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
1223                    }
1224                }
1225                size += self.__buffa_unknown_fields.encoded_len() as u32;
1226                size
1227            }
1228            #[allow(clippy::needless_borrow)]
1229            fn write_to(
1230                &self,
1231                _cache: &mut ::buffa::SizeCache,
1232                buf: &mut impl ::buffa::bytes::BufMut,
1233            ) {
1234                #[allow(unused_imports)]
1235                use ::buffa::Enumeration as _;
1236                if !self.symbol.is_empty() {
1237                    ::buffa::types::put_string_field(1u32, &self.symbol, buf);
1238                }
1239                {
1240                    let val = self.depth.to_i32();
1241                    if val != 0 {
1242                        ::buffa::types::put_int32_field(2u32, val, buf);
1243                    }
1244                }
1245                self.__buffa_unknown_fields.write_to(buf);
1246            }
1247        }
1248        /// Serializes this view as protobuf JSON.
1249        ///
1250        /// Implicit-presence fields with default values are omitted, `required`
1251        /// fields are always emitted, explicit-presence (`optional`) fields are
1252        /// emitted only when set, bytes fields are base64-encoded, and enum
1253        /// values are their proto name strings.
1254        ///
1255        /// This impl uses `serialize_map(None)` because the number of emitted
1256        /// fields depends on default-omission rules; serializers that require
1257        /// known map lengths (e.g. `bincode`) will return a runtime error.
1258        /// Use the owned message type for those formats.
1259        impl<'__a> ::serde::Serialize for GetOrderBookRequestView<'__a> {
1260            fn serialize<__S: ::serde::Serializer>(
1261                &self,
1262                __s: __S,
1263            ) -> ::core::result::Result<__S::Ok, __S::Error> {
1264                use ::serde::ser::SerializeMap as _;
1265                let mut __map = __s.serialize_map(::core::option::Option::None)?;
1266                if !::buffa::json_helpers::skip_if::is_empty_str(self.symbol) {
1267                    __map.serialize_entry("symbol", self.symbol)?;
1268                }
1269                if !::buffa::json_helpers::skip_if::is_default_enum_value(&self.depth) {
1270                    __map.serialize_entry("depth", &self.depth)?;
1271                }
1272                __map.end()
1273            }
1274        }
1275        impl<'a> ::buffa::MessageName for GetOrderBookRequestView<'a> {
1276            const PACKAGE: &'static str = "orderbook.v1";
1277            const NAME: &'static str = "GetOrderBookRequest";
1278            const FULL_NAME: &'static str = "orderbook.v1.GetOrderBookRequest";
1279            const TYPE_URL: &'static str = "type.googleapis.com/orderbook.v1.GetOrderBookRequest";
1280        }
1281        ::buffa::impl_default_view_instance!(GetOrderBookRequestView);
1282        ::buffa::impl_view_reborrow!(GetOrderBookRequestView);
1283        /** Self-contained, `'static` owned view of a `GetOrderBookRequest` message.
1284
1285 Wraps [`::buffa::OwnedView`]`<`[`GetOrderBookRequestView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
1286
1287 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetOrderBookRequestView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
1288        #[derive(Clone, Debug)]
1289        pub struct GetOrderBookRequestOwnedView(
1290            ::buffa::OwnedView<GetOrderBookRequestView<'static>>,
1291        );
1292        impl GetOrderBookRequestOwnedView {
1293            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
1294            ///
1295            /// The view borrows directly from the buffer's data; the buffer is
1296            /// retained inside the returned handle.
1297            ///
1298            /// # Errors
1299            ///
1300            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
1301            /// protobuf data.
1302            pub fn decode(
1303                bytes: ::buffa::bytes::Bytes,
1304            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1305                ::core::result::Result::Ok(
1306                    GetOrderBookRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
1307                )
1308            }
1309            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
1310            /// max message size).
1311            ///
1312            /// # Errors
1313            ///
1314            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
1315            /// exceeds the configured limits.
1316            pub fn decode_with_options(
1317                bytes: ::buffa::bytes::Bytes,
1318                opts: &::buffa::DecodeOptions,
1319            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1320                ::core::result::Result::Ok(
1321                    GetOrderBookRequestOwnedView(
1322                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
1323                    ),
1324                )
1325            }
1326            /// Build from an owned message via an encode → decode round-trip.
1327            ///
1328            /// # Errors
1329            ///
1330            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
1331            /// somehow invalid (should not happen for well-formed messages).
1332            pub fn from_owned(
1333                msg: &super::super::GetOrderBookRequest,
1334            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1335                ::core::result::Result::Ok(
1336                    GetOrderBookRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
1337                )
1338            }
1339            /// Borrow the full [`GetOrderBookRequestView`] with its lifetime tied to `&self`.
1340            #[must_use]
1341            pub fn view(&self) -> &GetOrderBookRequestView<'_> {
1342                self.0.reborrow()
1343            }
1344            /// Convert to the owned message type.
1345            ///
1346            /// # Errors
1347            ///
1348            /// Returns an error if re-materializing preserved unknown fields
1349            /// fails (e.g. the unknown-field limit is exceeded).
1350            pub fn to_owned_message(
1351                &self,
1352            ) -> ::core::result::Result<
1353                super::super::GetOrderBookRequest,
1354                ::buffa::DecodeError,
1355            > {
1356                self.0.to_owned_message()
1357            }
1358            /// The underlying bytes buffer.
1359            #[must_use]
1360            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
1361                self.0.bytes()
1362            }
1363            /// Consume the handle, returning the underlying bytes buffer.
1364            #[must_use]
1365            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
1366                self.0.into_bytes()
1367            }
1368            /// e.g. "BTC-USDT"; resolved to symbol_id server-side.
1369            ///
1370            /// Field 1: `symbol`
1371            #[must_use]
1372            pub fn symbol(&self) -> &'_ str {
1373                self.0.reborrow().symbol
1374            }
1375            /// Requested depth per side (number of price levels). Default is 50.
1376            ///
1377            /// Field 2: `depth`
1378            #[must_use]
1379            pub fn depth(&self) -> ::buffa::EnumValue<super::super::Depth> {
1380                self.0.reborrow().depth
1381            }
1382        }
1383        impl ::core::convert::From<::buffa::OwnedView<GetOrderBookRequestView<'static>>>
1384        for GetOrderBookRequestOwnedView {
1385            fn from(
1386                inner: ::buffa::OwnedView<GetOrderBookRequestView<'static>>,
1387            ) -> Self {
1388                GetOrderBookRequestOwnedView(inner)
1389            }
1390        }
1391        impl ::core::convert::From<GetOrderBookRequestOwnedView>
1392        for ::buffa::OwnedView<GetOrderBookRequestView<'static>> {
1393            fn from(wrapper: GetOrderBookRequestOwnedView) -> Self {
1394                wrapper.0
1395            }
1396        }
1397        impl ::core::convert::AsRef<::buffa::OwnedView<GetOrderBookRequestView<'static>>>
1398        for GetOrderBookRequestOwnedView {
1399            fn as_ref(&self) -> &::buffa::OwnedView<GetOrderBookRequestView<'static>> {
1400                &self.0
1401            }
1402        }
1403        impl ::buffa::HasMessageView for super::super::GetOrderBookRequest {
1404            type View<'a> = GetOrderBookRequestView<'a>;
1405            type ViewHandle = GetOrderBookRequestOwnedView;
1406        }
1407        impl ::serde::Serialize for GetOrderBookRequestOwnedView {
1408            fn serialize<__S: ::serde::Serializer>(
1409                &self,
1410                __s: __S,
1411            ) -> ::core::result::Result<__S::Ok, __S::Error> {
1412                ::serde::Serialize::serialize(&self.0, __s)
1413            }
1414        }
1415        /// PriceLevel uses scaled integers for the binary (protobuf) API (low-latency).
1416        /// REST surfaces expose decimal strings via DTO conversion.
1417        #[derive(Clone, Debug, Default)]
1418        pub struct PriceLevelView<'a> {
1419            /// Price in quote units scaled by 1e6.
1420            ///
1421            /// Field 1: `price_ticks`
1422            pub price_ticks: i64,
1423            /// Quantity scaled by the pair's base_quantity_scale from GetSpotConfig.
1424            ///
1425            /// Field 2: `qty_scaled`
1426            pub qty_scaled: i64,
1427            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1428        }
1429        impl<'a> ::buffa::MessageView<'a> for PriceLevelView<'a> {
1430            type Owned = super::super::PriceLevel;
1431            fn decode_view(
1432                buf: &'a [u8],
1433            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1434                let __limit = ::core::cell::Cell::new(
1435                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
1436                );
1437                <Self as ::buffa::MessageView>::decode_view_ctx(
1438                    buf,
1439                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
1440                )
1441            }
1442            fn decode_view_with_ctx(
1443                buf: &'a [u8],
1444                ctx: ::buffa::DecodeContext<'_>,
1445            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1446                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
1447            }
1448            fn merge_view_field(
1449                &mut self,
1450                tag: ::buffa::encoding::Tag,
1451                cur: &'a [u8],
1452                before_tag: &'a [u8],
1453                ctx: ::buffa::DecodeContext<'_>,
1454            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
1455                let _ = ctx;
1456                #[allow(unused_variables)]
1457                let view = self;
1458                let mut cur = cur;
1459                match tag.field_number() {
1460                    1u32 => {
1461                        ::buffa::encoding::check_wire_type(
1462                            tag,
1463                            ::buffa::encoding::WireType::Varint,
1464                        )?;
1465                        view.price_ticks = ::buffa::types::decode_int64(&mut cur)?;
1466                    }
1467                    2u32 => {
1468                        ::buffa::encoding::check_wire_type(
1469                            tag,
1470                            ::buffa::encoding::WireType::Varint,
1471                        )?;
1472                        view.qty_scaled = ::buffa::types::decode_int64(&mut cur)?;
1473                    }
1474                    _ => {
1475                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
1476                        let span_len = before_tag.len() - cur.len();
1477                        view.__buffa_unknown_fields
1478                            .push_record(before_tag, span_len, ctx)?;
1479                    }
1480                }
1481                ::core::result::Result::Ok(cur)
1482            }
1483            fn to_owned_message(
1484                &self,
1485            ) -> ::core::result::Result<super::super::PriceLevel, ::buffa::DecodeError> {
1486                self.to_owned_from_source(None)
1487            }
1488            #[allow(clippy::useless_conversion, clippy::needless_update)]
1489            fn to_owned_from_source(
1490                &self,
1491                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1492            ) -> ::core::result::Result<super::super::PriceLevel, ::buffa::DecodeError> {
1493                #[allow(unused_imports)]
1494                use ::buffa::alloc::string::ToString as _;
1495                let _ = __buffa_src;
1496                ::core::result::Result::Ok(super::super::PriceLevel {
1497                    price_ticks: self.price_ticks,
1498                    qty_scaled: self.qty_scaled,
1499                    __buffa_unknown_fields: self
1500                        .__buffa_unknown_fields
1501                        .to_owned()?
1502                        .into(),
1503                    ..::core::default::Default::default()
1504                })
1505            }
1506        }
1507        impl<'a> ::buffa::ViewEncode<'a> for PriceLevelView<'a> {
1508            #[allow(clippy::needless_borrow, clippy::let_and_return)]
1509            fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1510                #[allow(unused_imports)]
1511                use ::buffa::Enumeration as _;
1512                let mut size = 0u32;
1513                if self.price_ticks != 0i64 {
1514                    size
1515                        += 1u32
1516                            + ::buffa::types::int64_encoded_len(self.price_ticks) as u32;
1517                }
1518                if self.qty_scaled != 0i64 {
1519                    size
1520                        += 1u32
1521                            + ::buffa::types::int64_encoded_len(self.qty_scaled) as u32;
1522                }
1523                size += self.__buffa_unknown_fields.encoded_len() as u32;
1524                size
1525            }
1526            #[allow(clippy::needless_borrow)]
1527            fn write_to(
1528                &self,
1529                _cache: &mut ::buffa::SizeCache,
1530                buf: &mut impl ::buffa::bytes::BufMut,
1531            ) {
1532                #[allow(unused_imports)]
1533                use ::buffa::Enumeration as _;
1534                if self.price_ticks != 0i64 {
1535                    ::buffa::types::put_int64_field(1u32, self.price_ticks, buf);
1536                }
1537                if self.qty_scaled != 0i64 {
1538                    ::buffa::types::put_int64_field(2u32, self.qty_scaled, buf);
1539                }
1540                self.__buffa_unknown_fields.write_to(buf);
1541            }
1542        }
1543        /// Serializes this view as protobuf JSON.
1544        ///
1545        /// Implicit-presence fields with default values are omitted, `required`
1546        /// fields are always emitted, explicit-presence (`optional`) fields are
1547        /// emitted only when set, bytes fields are base64-encoded, and enum
1548        /// values are their proto name strings.
1549        ///
1550        /// This impl uses `serialize_map(None)` because the number of emitted
1551        /// fields depends on default-omission rules; serializers that require
1552        /// known map lengths (e.g. `bincode`) will return a runtime error.
1553        /// Use the owned message type for those formats.
1554        impl<'__a> ::serde::Serialize for PriceLevelView<'__a> {
1555            fn serialize<__S: ::serde::Serializer>(
1556                &self,
1557                __s: __S,
1558            ) -> ::core::result::Result<__S::Ok, __S::Error> {
1559                use ::serde::ser::SerializeMap as _;
1560                let mut __map = __s.serialize_map(::core::option::Option::None)?;
1561                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.price_ticks) {
1562                    __map
1563                        .serialize_entry(
1564                            "priceTicks",
1565                            &::buffa::json_helpers::ProtoJson(&self.price_ticks),
1566                        )?;
1567                }
1568                if !::buffa::json_helpers::skip_if::is_zero_i64(&self.qty_scaled) {
1569                    __map
1570                        .serialize_entry(
1571                            "qtyScaled",
1572                            &::buffa::json_helpers::ProtoJson(&self.qty_scaled),
1573                        )?;
1574                }
1575                __map.end()
1576            }
1577        }
1578        impl<'a> ::buffa::MessageName for PriceLevelView<'a> {
1579            const PACKAGE: &'static str = "orderbook.v1";
1580            const NAME: &'static str = "PriceLevel";
1581            const FULL_NAME: &'static str = "orderbook.v1.PriceLevel";
1582            const TYPE_URL: &'static str = "type.googleapis.com/orderbook.v1.PriceLevel";
1583        }
1584        ::buffa::impl_default_view_instance!(PriceLevelView);
1585        ::buffa::impl_view_reborrow!(PriceLevelView);
1586        /** Self-contained, `'static` owned view of a `PriceLevel` message.
1587
1588 Wraps [`::buffa::OwnedView`]`<`[`PriceLevelView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
1589
1590 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`PriceLevelView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
1591        #[derive(Clone, Debug)]
1592        pub struct PriceLevelOwnedView(::buffa::OwnedView<PriceLevelView<'static>>);
1593        impl PriceLevelOwnedView {
1594            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
1595            ///
1596            /// The view borrows directly from the buffer's data; the buffer is
1597            /// retained inside the returned handle.
1598            ///
1599            /// # Errors
1600            ///
1601            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
1602            /// protobuf data.
1603            pub fn decode(
1604                bytes: ::buffa::bytes::Bytes,
1605            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1606                ::core::result::Result::Ok(
1607                    PriceLevelOwnedView(::buffa::OwnedView::decode(bytes)?),
1608                )
1609            }
1610            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
1611            /// max message size).
1612            ///
1613            /// # Errors
1614            ///
1615            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
1616            /// exceeds the configured limits.
1617            pub fn decode_with_options(
1618                bytes: ::buffa::bytes::Bytes,
1619                opts: &::buffa::DecodeOptions,
1620            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1621                ::core::result::Result::Ok(
1622                    PriceLevelOwnedView(
1623                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
1624                    ),
1625                )
1626            }
1627            /// Build from an owned message via an encode → decode round-trip.
1628            ///
1629            /// # Errors
1630            ///
1631            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
1632            /// somehow invalid (should not happen for well-formed messages).
1633            pub fn from_owned(
1634                msg: &super::super::PriceLevel,
1635            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1636                ::core::result::Result::Ok(
1637                    PriceLevelOwnedView(::buffa::OwnedView::from_owned(msg)?),
1638                )
1639            }
1640            /// Borrow the full [`PriceLevelView`] with its lifetime tied to `&self`.
1641            #[must_use]
1642            pub fn view(&self) -> &PriceLevelView<'_> {
1643                self.0.reborrow()
1644            }
1645            /// Convert to the owned message type.
1646            ///
1647            /// # Errors
1648            ///
1649            /// Returns an error if re-materializing preserved unknown fields
1650            /// fails (e.g. the unknown-field limit is exceeded).
1651            pub fn to_owned_message(
1652                &self,
1653            ) -> ::core::result::Result<super::super::PriceLevel, ::buffa::DecodeError> {
1654                self.0.to_owned_message()
1655            }
1656            /// The underlying bytes buffer.
1657            #[must_use]
1658            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
1659                self.0.bytes()
1660            }
1661            /// Consume the handle, returning the underlying bytes buffer.
1662            #[must_use]
1663            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
1664                self.0.into_bytes()
1665            }
1666            /// Price in quote units scaled by 1e6.
1667            ///
1668            /// Field 1: `price_ticks`
1669            #[must_use]
1670            pub fn price_ticks(&self) -> i64 {
1671                self.0.reborrow().price_ticks
1672            }
1673            /// Quantity scaled by the pair's base_quantity_scale from GetSpotConfig.
1674            ///
1675            /// Field 2: `qty_scaled`
1676            #[must_use]
1677            pub fn qty_scaled(&self) -> i64 {
1678                self.0.reborrow().qty_scaled
1679            }
1680        }
1681        impl ::core::convert::From<::buffa::OwnedView<PriceLevelView<'static>>>
1682        for PriceLevelOwnedView {
1683            fn from(inner: ::buffa::OwnedView<PriceLevelView<'static>>) -> Self {
1684                PriceLevelOwnedView(inner)
1685            }
1686        }
1687        impl ::core::convert::From<PriceLevelOwnedView>
1688        for ::buffa::OwnedView<PriceLevelView<'static>> {
1689            fn from(wrapper: PriceLevelOwnedView) -> Self {
1690                wrapper.0
1691            }
1692        }
1693        impl ::core::convert::AsRef<::buffa::OwnedView<PriceLevelView<'static>>>
1694        for PriceLevelOwnedView {
1695            fn as_ref(&self) -> &::buffa::OwnedView<PriceLevelView<'static>> {
1696                &self.0
1697            }
1698        }
1699        impl ::buffa::HasMessageView for super::super::PriceLevel {
1700            type View<'a> = PriceLevelView<'a>;
1701            type ViewHandle = PriceLevelOwnedView;
1702        }
1703        impl ::serde::Serialize for PriceLevelOwnedView {
1704            fn serialize<__S: ::serde::Serializer>(
1705                &self,
1706                __s: __S,
1707            ) -> ::core::result::Result<__S::Ok, __S::Error> {
1708                ::serde::Serialize::serialize(&self.0, __s)
1709            }
1710        }
1711        /// GetOrderBookResponse is a depth snapshot for the binary (protobuf) API (scaled integers).
1712        /// REST surfaces expose decimal strings via DTO conversion.
1713        #[derive(Clone, Debug, Default)]
1714        pub struct GetOrderBookResponseView<'a> {
1715            /// Numeric symbol identifier (client resolves to symbol string).
1716            ///
1717            /// Field 1: `symbol_id`
1718            pub symbol_id: u32,
1719            /// Monotonic book sequence for this symbol.
1720            ///
1721            /// Field 2: `book_seq`
1722            pub book_seq: u64,
1723            /// Best bid first; descending price.
1724            ///
1725            /// Field 3: `bids`
1726            pub bids: ::buffa::RepeatedView<
1727                'a,
1728                super::super::__buffa::view::PriceLevelView<'a>,
1729            >,
1730            /// Best ask first; ascending price.
1731            ///
1732            /// Field 4: `asks`
1733            pub asks: ::buffa::RepeatedView<
1734                'a,
1735                super::super::__buffa::view::PriceLevelView<'a>,
1736            >,
1737            /// Timestamp associated with this snapshot (best-effort).
1738            ///
1739            /// Field 5: `ts`
1740            pub ts: ::buffa::MessageFieldView<
1741                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
1742            >,
1743            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
1744        }
1745        impl<'a> ::buffa::MessageView<'a> for GetOrderBookResponseView<'a> {
1746            type Owned = super::super::GetOrderBookResponse;
1747            fn decode_view(
1748                buf: &'a [u8],
1749            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1750                let __limit = ::core::cell::Cell::new(
1751                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
1752                );
1753                <Self as ::buffa::MessageView>::decode_view_ctx(
1754                    buf,
1755                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
1756                )
1757            }
1758            fn decode_view_with_ctx(
1759                buf: &'a [u8],
1760                ctx: ::buffa::DecodeContext<'_>,
1761            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
1762                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
1763            }
1764            fn merge_view_field(
1765                &mut self,
1766                tag: ::buffa::encoding::Tag,
1767                cur: &'a [u8],
1768                before_tag: &'a [u8],
1769                ctx: ::buffa::DecodeContext<'_>,
1770            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
1771                let _ = ctx;
1772                #[allow(unused_variables)]
1773                let view = self;
1774                let mut cur = cur;
1775                match tag.field_number() {
1776                    1u32 => {
1777                        ::buffa::encoding::check_wire_type(
1778                            tag,
1779                            ::buffa::encoding::WireType::Varint,
1780                        )?;
1781                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
1782                    }
1783                    2u32 => {
1784                        ::buffa::encoding::check_wire_type(
1785                            tag,
1786                            ::buffa::encoding::WireType::Varint,
1787                        )?;
1788                        view.book_seq = ::buffa::types::decode_uint64(&mut cur)?;
1789                    }
1790                    5u32 => {
1791                        ::buffa::encoding::check_wire_type(
1792                            tag,
1793                            ::buffa::encoding::WireType::LengthDelimited,
1794                        )?;
1795                        let __sub_ctx = ctx.descend()?;
1796                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
1797                        match view.ts.as_mut() {
1798                            Some(existing) => {
1799                                ::buffa::MessageView::merge_into_view(
1800                                    existing,
1801                                    sub,
1802                                    __sub_ctx,
1803                                )?
1804                            }
1805                            None => {
1806                                view.ts = ::buffa::MessageFieldView::set(
1807                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
1808                                        sub,
1809                                        __sub_ctx,
1810                                    )?,
1811                                );
1812                            }
1813                        }
1814                    }
1815                    3u32 => {
1816                        ::buffa::encoding::check_wire_type(
1817                            tag,
1818                            ::buffa::encoding::WireType::LengthDelimited,
1819                        )?;
1820                        let __sub_ctx = ctx.descend()?;
1821                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
1822                        view.bids
1823                            .push(
1824                                <super::super::__buffa::view::PriceLevelView as ::buffa::MessageView>::decode_view_ctx(
1825                                    sub,
1826                                    __sub_ctx,
1827                                )?,
1828                            );
1829                    }
1830                    4u32 => {
1831                        ::buffa::encoding::check_wire_type(
1832                            tag,
1833                            ::buffa::encoding::WireType::LengthDelimited,
1834                        )?;
1835                        let __sub_ctx = ctx.descend()?;
1836                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
1837                        view.asks
1838                            .push(
1839                                <super::super::__buffa::view::PriceLevelView as ::buffa::MessageView>::decode_view_ctx(
1840                                    sub,
1841                                    __sub_ctx,
1842                                )?,
1843                            );
1844                    }
1845                    _ => {
1846                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
1847                        let span_len = before_tag.len() - cur.len();
1848                        view.__buffa_unknown_fields
1849                            .push_record(before_tag, span_len, ctx)?;
1850                    }
1851                }
1852                ::core::result::Result::Ok(cur)
1853            }
1854            fn to_owned_message(
1855                &self,
1856            ) -> ::core::result::Result<
1857                super::super::GetOrderBookResponse,
1858                ::buffa::DecodeError,
1859            > {
1860                self.to_owned_from_source(None)
1861            }
1862            #[allow(clippy::useless_conversion, clippy::needless_update)]
1863            fn to_owned_from_source(
1864                &self,
1865                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
1866            ) -> ::core::result::Result<
1867                super::super::GetOrderBookResponse,
1868                ::buffa::DecodeError,
1869            > {
1870                #[allow(unused_imports)]
1871                use ::buffa::alloc::string::ToString as _;
1872                let _ = __buffa_src;
1873                ::core::result::Result::Ok(super::super::GetOrderBookResponse {
1874                    symbol_id: self.symbol_id,
1875                    book_seq: self.book_seq,
1876                    bids: self
1877                        .bids
1878                        .iter()
1879                        .map(|v| v.to_owned_from_source(__buffa_src))
1880                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
1881                    asks: self
1882                        .asks
1883                        .iter()
1884                        .map(|v| v.to_owned_from_source(__buffa_src))
1885                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
1886                    ts: match self.ts.as_option() {
1887                        Some(v) => {
1888                            ::buffa::MessageField::<
1889                                ::buffa_types::google::protobuf::Timestamp,
1890                            >::some(v.to_owned_from_source(__buffa_src)?)
1891                        }
1892                        None => ::buffa::MessageField::none(),
1893                    },
1894                    __buffa_unknown_fields: self
1895                        .__buffa_unknown_fields
1896                        .to_owned()?
1897                        .into(),
1898                    ..::core::default::Default::default()
1899                })
1900            }
1901        }
1902        impl<'a> ::buffa::ViewEncode<'a> for GetOrderBookResponseView<'a> {
1903            #[allow(clippy::needless_borrow, clippy::let_and_return)]
1904            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
1905                #[allow(unused_imports)]
1906                use ::buffa::Enumeration as _;
1907                let mut size = 0u32;
1908                if self.symbol_id != 0u32 {
1909                    size
1910                        += 1u32
1911                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
1912                }
1913                if self.book_seq != 0u64 {
1914                    size
1915                        += 1u32
1916                            + ::buffa::types::uint64_encoded_len(self.book_seq) as u32;
1917                }
1918                for v in &self.bids {
1919                    let __slot = __cache.reserve();
1920                    let inner_size = v.compute_size(__cache);
1921                    __cache.set(__slot, inner_size);
1922                    size
1923                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1924                            + inner_size;
1925                }
1926                for v in &self.asks {
1927                    let __slot = __cache.reserve();
1928                    let inner_size = v.compute_size(__cache);
1929                    __cache.set(__slot, inner_size);
1930                    size
1931                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1932                            + inner_size;
1933                }
1934                if self.ts.is_set() {
1935                    let __slot = __cache.reserve();
1936                    let inner_size = self.ts.compute_size(__cache);
1937                    __cache.set(__slot, inner_size);
1938                    size
1939                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1940                            + inner_size;
1941                }
1942                size += self.__buffa_unknown_fields.encoded_len() as u32;
1943                size
1944            }
1945            #[allow(clippy::needless_borrow)]
1946            fn write_to(
1947                &self,
1948                __cache: &mut ::buffa::SizeCache,
1949                buf: &mut impl ::buffa::bytes::BufMut,
1950            ) {
1951                #[allow(unused_imports)]
1952                use ::buffa::Enumeration as _;
1953                if self.symbol_id != 0u32 {
1954                    ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
1955                }
1956                if self.book_seq != 0u64 {
1957                    ::buffa::types::put_uint64_field(2u32, self.book_seq, buf);
1958                }
1959                for v in &self.bids {
1960                    ::buffa::types::put_len_delimited_header(
1961                        3u32,
1962                        __cache.consume_next(),
1963                        buf,
1964                    );
1965                    v.write_to(__cache, buf);
1966                }
1967                for v in &self.asks {
1968                    ::buffa::types::put_len_delimited_header(
1969                        4u32,
1970                        __cache.consume_next(),
1971                        buf,
1972                    );
1973                    v.write_to(__cache, buf);
1974                }
1975                if self.ts.is_set() {
1976                    ::buffa::types::put_len_delimited_header(
1977                        5u32,
1978                        __cache.consume_next(),
1979                        buf,
1980                    );
1981                    self.ts.write_to(__cache, buf);
1982                }
1983                self.__buffa_unknown_fields.write_to(buf);
1984            }
1985        }
1986        /// Serializes this view as protobuf JSON.
1987        ///
1988        /// Implicit-presence fields with default values are omitted, `required`
1989        /// fields are always emitted, explicit-presence (`optional`) fields are
1990        /// emitted only when set, bytes fields are base64-encoded, and enum
1991        /// values are their proto name strings.
1992        ///
1993        /// This impl uses `serialize_map(None)` because the number of emitted
1994        /// fields depends on default-omission rules; serializers that require
1995        /// known map lengths (e.g. `bincode`) will return a runtime error.
1996        /// Use the owned message type for those formats.
1997        impl<'__a> ::serde::Serialize for GetOrderBookResponseView<'__a> {
1998            fn serialize<__S: ::serde::Serializer>(
1999                &self,
2000                __s: __S,
2001            ) -> ::core::result::Result<__S::Ok, __S::Error> {
2002                use ::serde::ser::SerializeMap as _;
2003                let mut __map = __s.serialize_map(::core::option::Option::None)?;
2004                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
2005                    __map
2006                        .serialize_entry(
2007                            "symbolId",
2008                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
2009                        )?;
2010                }
2011                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.book_seq) {
2012                    __map
2013                        .serialize_entry(
2014                            "bookSeq",
2015                            &::buffa::json_helpers::ProtoJson(&self.book_seq),
2016                        )?;
2017                }
2018                if !self.bids.is_empty() {
2019                    __map.serialize_entry("bids", &*self.bids)?;
2020                }
2021                if !self.asks.is_empty() {
2022                    __map.serialize_entry("asks", &*self.asks)?;
2023                }
2024                {
2025                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
2026                        __map.serialize_entry("ts", __v)?;
2027                    }
2028                }
2029                __map.end()
2030            }
2031        }
2032        impl<'a> ::buffa::MessageName for GetOrderBookResponseView<'a> {
2033            const PACKAGE: &'static str = "orderbook.v1";
2034            const NAME: &'static str = "GetOrderBookResponse";
2035            const FULL_NAME: &'static str = "orderbook.v1.GetOrderBookResponse";
2036            const TYPE_URL: &'static str = "type.googleapis.com/orderbook.v1.GetOrderBookResponse";
2037        }
2038        ::buffa::impl_default_view_instance!(GetOrderBookResponseView);
2039        ::buffa::impl_view_reborrow!(GetOrderBookResponseView);
2040        /** Self-contained, `'static` owned view of a `GetOrderBookResponse` message.
2041
2042 Wraps [`::buffa::OwnedView`]`<`[`GetOrderBookResponseView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
2043
2044 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`GetOrderBookResponseView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
2045        #[derive(Clone, Debug)]
2046        pub struct GetOrderBookResponseOwnedView(
2047            ::buffa::OwnedView<GetOrderBookResponseView<'static>>,
2048        );
2049        impl GetOrderBookResponseOwnedView {
2050            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
2051            ///
2052            /// The view borrows directly from the buffer's data; the buffer is
2053            /// retained inside the returned handle.
2054            ///
2055            /// # Errors
2056            ///
2057            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
2058            /// protobuf data.
2059            pub fn decode(
2060                bytes: ::buffa::bytes::Bytes,
2061            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2062                ::core::result::Result::Ok(
2063                    GetOrderBookResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
2064                )
2065            }
2066            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
2067            /// max message size).
2068            ///
2069            /// # Errors
2070            ///
2071            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
2072            /// exceeds the configured limits.
2073            pub fn decode_with_options(
2074                bytes: ::buffa::bytes::Bytes,
2075                opts: &::buffa::DecodeOptions,
2076            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2077                ::core::result::Result::Ok(
2078                    GetOrderBookResponseOwnedView(
2079                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
2080                    ),
2081                )
2082            }
2083            /// Build from an owned message via an encode → decode round-trip.
2084            ///
2085            /// # Errors
2086            ///
2087            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
2088            /// somehow invalid (should not happen for well-formed messages).
2089            pub fn from_owned(
2090                msg: &super::super::GetOrderBookResponse,
2091            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2092                ::core::result::Result::Ok(
2093                    GetOrderBookResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
2094                )
2095            }
2096            /// Borrow the full [`GetOrderBookResponseView`] with its lifetime tied to `&self`.
2097            #[must_use]
2098            pub fn view(&self) -> &GetOrderBookResponseView<'_> {
2099                self.0.reborrow()
2100            }
2101            /// Convert to the owned message type.
2102            ///
2103            /// # Errors
2104            ///
2105            /// Returns an error if re-materializing preserved unknown fields
2106            /// fails (e.g. the unknown-field limit is exceeded).
2107            pub fn to_owned_message(
2108                &self,
2109            ) -> ::core::result::Result<
2110                super::super::GetOrderBookResponse,
2111                ::buffa::DecodeError,
2112            > {
2113                self.0.to_owned_message()
2114            }
2115            /// The underlying bytes buffer.
2116            #[must_use]
2117            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
2118                self.0.bytes()
2119            }
2120            /// Consume the handle, returning the underlying bytes buffer.
2121            #[must_use]
2122            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
2123                self.0.into_bytes()
2124            }
2125            /// Numeric symbol identifier (client resolves to symbol string).
2126            ///
2127            /// Field 1: `symbol_id`
2128            #[must_use]
2129            pub fn symbol_id(&self) -> u32 {
2130                self.0.reborrow().symbol_id
2131            }
2132            /// Monotonic book sequence for this symbol.
2133            ///
2134            /// Field 2: `book_seq`
2135            #[must_use]
2136            pub fn book_seq(&self) -> u64 {
2137                self.0.reborrow().book_seq
2138            }
2139            /// Best bid first; descending price.
2140            ///
2141            /// Field 3: `bids`
2142            #[must_use]
2143            pub fn bids(
2144                &self,
2145            ) -> &::buffa::RepeatedView<
2146                '_,
2147                super::super::__buffa::view::PriceLevelView<'_>,
2148            > {
2149                &self.0.reborrow().bids
2150            }
2151            /// Best ask first; ascending price.
2152            ///
2153            /// Field 4: `asks`
2154            #[must_use]
2155            pub fn asks(
2156                &self,
2157            ) -> &::buffa::RepeatedView<
2158                '_,
2159                super::super::__buffa::view::PriceLevelView<'_>,
2160            > {
2161                &self.0.reborrow().asks
2162            }
2163            /// Timestamp associated with this snapshot (best-effort).
2164            ///
2165            /// Field 5: `ts`
2166            #[must_use]
2167            pub fn ts(
2168                &self,
2169            ) -> &::buffa::MessageFieldView<
2170                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
2171            > {
2172                &self.0.reborrow().ts
2173            }
2174        }
2175        impl ::core::convert::From<::buffa::OwnedView<GetOrderBookResponseView<'static>>>
2176        for GetOrderBookResponseOwnedView {
2177            fn from(
2178                inner: ::buffa::OwnedView<GetOrderBookResponseView<'static>>,
2179            ) -> Self {
2180                GetOrderBookResponseOwnedView(inner)
2181            }
2182        }
2183        impl ::core::convert::From<GetOrderBookResponseOwnedView>
2184        for ::buffa::OwnedView<GetOrderBookResponseView<'static>> {
2185            fn from(wrapper: GetOrderBookResponseOwnedView) -> Self {
2186                wrapper.0
2187            }
2188        }
2189        impl ::core::convert::AsRef<
2190            ::buffa::OwnedView<GetOrderBookResponseView<'static>>,
2191        > for GetOrderBookResponseOwnedView {
2192            fn as_ref(&self) -> &::buffa::OwnedView<GetOrderBookResponseView<'static>> {
2193                &self.0
2194            }
2195        }
2196        impl ::buffa::HasMessageView for super::super::GetOrderBookResponse {
2197            type View<'a> = GetOrderBookResponseView<'a>;
2198            type ViewHandle = GetOrderBookResponseOwnedView;
2199        }
2200        impl ::serde::Serialize for GetOrderBookResponseOwnedView {
2201            fn serialize<__S: ::serde::Serializer>(
2202                &self,
2203                __s: __S,
2204            ) -> ::core::result::Result<__S::Ok, __S::Error> {
2205                ::serde::Serialize::serialize(&self.0, __s)
2206            }
2207        }
2208        /// OrderBookDelta is an incremental update to the orderbook state.
2209        /// Uses scaled integers (binary protobuf) for realtime streaming performance.
2210        ///
2211        /// Semantics:
2212        /// - For each side, each \[price_ticks\] entry is a SET at that price:
2213        ///   - qty_scaled \> 0 =\> set/replace that level quantity
2214        ///   - qty_scaled == 0 =\> delete that level
2215        /// - reset=true indicates the book should be cleared before applying any levels.
2216        ///
2217        /// Clients are expected to initialize from GetOrderBook (snapshot) and then
2218        /// apply deltas in order. If a gap is detected, clients should refetch a
2219        /// snapshot.
2220        #[derive(Clone, Debug, Default)]
2221        pub struct OrderBookDeltaView<'a> {
2222            /// Numeric symbol identifier.
2223            ///
2224            /// Field 1: `symbol_id`
2225            pub symbol_id: u32,
2226            /// Monotonic book sequence range covered by this update.
2227            /// When reset=true, book_seq_start may be 0.
2228            ///
2229            /// Field 2: `book_seq_start`
2230            pub book_seq_start: u64,
2231            /// Monotonic book sequence at the end of this update's range. Consumers can
2232            /// retain it as the last applied sequence and ignore updates that do not advance it.
2233            ///
2234            /// Field 3: `book_seq_end`
2235            pub book_seq_end: u64,
2236            /// Bid-side updates (SET semantics at price_ticks).
2237            ///
2238            /// Field 4: `bids`
2239            pub bids: ::buffa::RepeatedView<
2240                'a,
2241                super::super::__buffa::view::PriceLevelView<'a>,
2242            >,
2243            /// Ask-side updates (SET semantics at price_ticks).
2244            ///
2245            /// Field 5: `asks`
2246            pub asks: ::buffa::RepeatedView<
2247                'a,
2248                super::super::__buffa::view::PriceLevelView<'a>,
2249            >,
2250            /// If true, consumers should clear their local book state before applying
2251            /// updates.
2252            ///
2253            /// Field 6: `reset`
2254            pub reset: bool,
2255            /// Timestamp associated with this update (best-effort).
2256            ///
2257            /// Field 7: `ts`
2258            pub ts: ::buffa::MessageFieldView<
2259                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'a>,
2260            >,
2261            pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
2262        }
2263        impl<'a> ::buffa::MessageView<'a> for OrderBookDeltaView<'a> {
2264            type Owned = super::super::OrderBookDelta;
2265            fn decode_view(
2266                buf: &'a [u8],
2267            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2268                let __limit = ::core::cell::Cell::new(
2269                    ::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT,
2270                );
2271                <Self as ::buffa::MessageView>::decode_view_ctx(
2272                    buf,
2273                    ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit),
2274                )
2275            }
2276            fn decode_view_with_ctx(
2277                buf: &'a [u8],
2278                ctx: ::buffa::DecodeContext<'_>,
2279            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2280                <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
2281            }
2282            fn merge_view_field(
2283                &mut self,
2284                tag: ::buffa::encoding::Tag,
2285                cur: &'a [u8],
2286                before_tag: &'a [u8],
2287                ctx: ::buffa::DecodeContext<'_>,
2288            ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
2289                let _ = ctx;
2290                #[allow(unused_variables)]
2291                let view = self;
2292                let mut cur = cur;
2293                match tag.field_number() {
2294                    1u32 => {
2295                        ::buffa::encoding::check_wire_type(
2296                            tag,
2297                            ::buffa::encoding::WireType::Varint,
2298                        )?;
2299                        view.symbol_id = ::buffa::types::decode_uint32(&mut cur)?;
2300                    }
2301                    2u32 => {
2302                        ::buffa::encoding::check_wire_type(
2303                            tag,
2304                            ::buffa::encoding::WireType::Varint,
2305                        )?;
2306                        view.book_seq_start = ::buffa::types::decode_uint64(&mut cur)?;
2307                    }
2308                    3u32 => {
2309                        ::buffa::encoding::check_wire_type(
2310                            tag,
2311                            ::buffa::encoding::WireType::Varint,
2312                        )?;
2313                        view.book_seq_end = ::buffa::types::decode_uint64(&mut cur)?;
2314                    }
2315                    6u32 => {
2316                        ::buffa::encoding::check_wire_type(
2317                            tag,
2318                            ::buffa::encoding::WireType::Varint,
2319                        )?;
2320                        view.reset = ::buffa::types::decode_bool(&mut cur)?;
2321                    }
2322                    7u32 => {
2323                        ::buffa::encoding::check_wire_type(
2324                            tag,
2325                            ::buffa::encoding::WireType::LengthDelimited,
2326                        )?;
2327                        let __sub_ctx = ctx.descend()?;
2328                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
2329                        match view.ts.as_mut() {
2330                            Some(existing) => {
2331                                ::buffa::MessageView::merge_into_view(
2332                                    existing,
2333                                    sub,
2334                                    __sub_ctx,
2335                                )?
2336                            }
2337                            None => {
2338                                view.ts = ::buffa::MessageFieldView::set(
2339                                    <::buffa_types::google::protobuf::__buffa::view::TimestampView as ::buffa::MessageView>::decode_view_ctx(
2340                                        sub,
2341                                        __sub_ctx,
2342                                    )?,
2343                                );
2344                            }
2345                        }
2346                    }
2347                    4u32 => {
2348                        ::buffa::encoding::check_wire_type(
2349                            tag,
2350                            ::buffa::encoding::WireType::LengthDelimited,
2351                        )?;
2352                        let __sub_ctx = ctx.descend()?;
2353                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
2354                        view.bids
2355                            .push(
2356                                <super::super::__buffa::view::PriceLevelView as ::buffa::MessageView>::decode_view_ctx(
2357                                    sub,
2358                                    __sub_ctx,
2359                                )?,
2360                            );
2361                    }
2362                    5u32 => {
2363                        ::buffa::encoding::check_wire_type(
2364                            tag,
2365                            ::buffa::encoding::WireType::LengthDelimited,
2366                        )?;
2367                        let __sub_ctx = ctx.descend()?;
2368                        let sub = ::buffa::types::borrow_bytes(&mut cur)?;
2369                        view.asks
2370                            .push(
2371                                <super::super::__buffa::view::PriceLevelView as ::buffa::MessageView>::decode_view_ctx(
2372                                    sub,
2373                                    __sub_ctx,
2374                                )?,
2375                            );
2376                    }
2377                    _ => {
2378                        ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
2379                        let span_len = before_tag.len() - cur.len();
2380                        view.__buffa_unknown_fields
2381                            .push_record(before_tag, span_len, ctx)?;
2382                    }
2383                }
2384                ::core::result::Result::Ok(cur)
2385            }
2386            fn to_owned_message(
2387                &self,
2388            ) -> ::core::result::Result<
2389                super::super::OrderBookDelta,
2390                ::buffa::DecodeError,
2391            > {
2392                self.to_owned_from_source(None)
2393            }
2394            #[allow(clippy::useless_conversion, clippy::needless_update)]
2395            fn to_owned_from_source(
2396                &self,
2397                __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
2398            ) -> ::core::result::Result<
2399                super::super::OrderBookDelta,
2400                ::buffa::DecodeError,
2401            > {
2402                #[allow(unused_imports)]
2403                use ::buffa::alloc::string::ToString as _;
2404                let _ = __buffa_src;
2405                ::core::result::Result::Ok(super::super::OrderBookDelta {
2406                    symbol_id: self.symbol_id,
2407                    book_seq_start: self.book_seq_start,
2408                    book_seq_end: self.book_seq_end,
2409                    bids: self
2410                        .bids
2411                        .iter()
2412                        .map(|v| v.to_owned_from_source(__buffa_src))
2413                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
2414                    asks: self
2415                        .asks
2416                        .iter()
2417                        .map(|v| v.to_owned_from_source(__buffa_src))
2418                        .collect::<::core::result::Result<_, ::buffa::DecodeError>>()?,
2419                    reset: self.reset,
2420                    ts: match self.ts.as_option() {
2421                        Some(v) => {
2422                            ::buffa::MessageField::<
2423                                ::buffa_types::google::protobuf::Timestamp,
2424                            >::some(v.to_owned_from_source(__buffa_src)?)
2425                        }
2426                        None => ::buffa::MessageField::none(),
2427                    },
2428                    __buffa_unknown_fields: self
2429                        .__buffa_unknown_fields
2430                        .to_owned()?
2431                        .into(),
2432                    ..::core::default::Default::default()
2433                })
2434            }
2435        }
2436        impl<'a> ::buffa::ViewEncode<'a> for OrderBookDeltaView<'a> {
2437            #[allow(clippy::needless_borrow, clippy::let_and_return)]
2438            fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2439                #[allow(unused_imports)]
2440                use ::buffa::Enumeration as _;
2441                let mut size = 0u32;
2442                if self.symbol_id != 0u32 {
2443                    size
2444                        += 1u32
2445                            + ::buffa::types::uint32_encoded_len(self.symbol_id) as u32;
2446                }
2447                if self.book_seq_start != 0u64 {
2448                    size
2449                        += 1u32
2450                            + ::buffa::types::uint64_encoded_len(self.book_seq_start)
2451                                as u32;
2452                }
2453                if self.book_seq_end != 0u64 {
2454                    size
2455                        += 1u32
2456                            + ::buffa::types::uint64_encoded_len(self.book_seq_end)
2457                                as u32;
2458                }
2459                for v in &self.bids {
2460                    let __slot = __cache.reserve();
2461                    let inner_size = v.compute_size(__cache);
2462                    __cache.set(__slot, inner_size);
2463                    size
2464                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2465                            + inner_size;
2466                }
2467                for v in &self.asks {
2468                    let __slot = __cache.reserve();
2469                    let inner_size = v.compute_size(__cache);
2470                    __cache.set(__slot, inner_size);
2471                    size
2472                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2473                            + inner_size;
2474                }
2475                if self.reset {
2476                    size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
2477                }
2478                if self.ts.is_set() {
2479                    let __slot = __cache.reserve();
2480                    let inner_size = self.ts.compute_size(__cache);
2481                    __cache.set(__slot, inner_size);
2482                    size
2483                        += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2484                            + inner_size;
2485                }
2486                size += self.__buffa_unknown_fields.encoded_len() as u32;
2487                size
2488            }
2489            #[allow(clippy::needless_borrow)]
2490            fn write_to(
2491                &self,
2492                __cache: &mut ::buffa::SizeCache,
2493                buf: &mut impl ::buffa::bytes::BufMut,
2494            ) {
2495                #[allow(unused_imports)]
2496                use ::buffa::Enumeration as _;
2497                if self.symbol_id != 0u32 {
2498                    ::buffa::types::put_uint32_field(1u32, self.symbol_id, buf);
2499                }
2500                if self.book_seq_start != 0u64 {
2501                    ::buffa::types::put_uint64_field(2u32, self.book_seq_start, buf);
2502                }
2503                if self.book_seq_end != 0u64 {
2504                    ::buffa::types::put_uint64_field(3u32, self.book_seq_end, buf);
2505                }
2506                for v in &self.bids {
2507                    ::buffa::types::put_len_delimited_header(
2508                        4u32,
2509                        __cache.consume_next(),
2510                        buf,
2511                    );
2512                    v.write_to(__cache, buf);
2513                }
2514                for v in &self.asks {
2515                    ::buffa::types::put_len_delimited_header(
2516                        5u32,
2517                        __cache.consume_next(),
2518                        buf,
2519                    );
2520                    v.write_to(__cache, buf);
2521                }
2522                if self.reset {
2523                    ::buffa::types::put_bool_field(6u32, self.reset, buf);
2524                }
2525                if self.ts.is_set() {
2526                    ::buffa::types::put_len_delimited_header(
2527                        7u32,
2528                        __cache.consume_next(),
2529                        buf,
2530                    );
2531                    self.ts.write_to(__cache, buf);
2532                }
2533                self.__buffa_unknown_fields.write_to(buf);
2534            }
2535        }
2536        /// Serializes this view as protobuf JSON.
2537        ///
2538        /// Implicit-presence fields with default values are omitted, `required`
2539        /// fields are always emitted, explicit-presence (`optional`) fields are
2540        /// emitted only when set, bytes fields are base64-encoded, and enum
2541        /// values are their proto name strings.
2542        ///
2543        /// This impl uses `serialize_map(None)` because the number of emitted
2544        /// fields depends on default-omission rules; serializers that require
2545        /// known map lengths (e.g. `bincode`) will return a runtime error.
2546        /// Use the owned message type for those formats.
2547        impl<'__a> ::serde::Serialize for OrderBookDeltaView<'__a> {
2548            fn serialize<__S: ::serde::Serializer>(
2549                &self,
2550                __s: __S,
2551            ) -> ::core::result::Result<__S::Ok, __S::Error> {
2552                use ::serde::ser::SerializeMap as _;
2553                let mut __map = __s.serialize_map(::core::option::Option::None)?;
2554                if !::buffa::json_helpers::skip_if::is_zero_u32(&self.symbol_id) {
2555                    __map
2556                        .serialize_entry(
2557                            "symbolId",
2558                            &::buffa::json_helpers::ProtoJson(&self.symbol_id),
2559                        )?;
2560                }
2561                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.book_seq_start) {
2562                    __map
2563                        .serialize_entry(
2564                            "bookSeqStart",
2565                            &::buffa::json_helpers::ProtoJson(&self.book_seq_start),
2566                        )?;
2567                }
2568                if !::buffa::json_helpers::skip_if::is_zero_u64(&self.book_seq_end) {
2569                    __map
2570                        .serialize_entry(
2571                            "bookSeqEnd",
2572                            &::buffa::json_helpers::ProtoJson(&self.book_seq_end),
2573                        )?;
2574                }
2575                if !self.bids.is_empty() {
2576                    __map.serialize_entry("bids", &*self.bids)?;
2577                }
2578                if !self.asks.is_empty() {
2579                    __map.serialize_entry("asks", &*self.asks)?;
2580                }
2581                if self.reset {
2582                    __map.serialize_entry("reset", &self.reset)?;
2583                }
2584                {
2585                    if let ::core::option::Option::Some(__v) = self.ts.as_option() {
2586                        __map.serialize_entry("ts", __v)?;
2587                    }
2588                }
2589                __map.end()
2590            }
2591        }
2592        impl<'a> ::buffa::MessageName for OrderBookDeltaView<'a> {
2593            const PACKAGE: &'static str = "orderbook.v1";
2594            const NAME: &'static str = "OrderBookDelta";
2595            const FULL_NAME: &'static str = "orderbook.v1.OrderBookDelta";
2596            const TYPE_URL: &'static str = "type.googleapis.com/orderbook.v1.OrderBookDelta";
2597        }
2598        ::buffa::impl_default_view_instance!(OrderBookDeltaView);
2599        ::buffa::impl_view_reborrow!(OrderBookDeltaView);
2600        /** Self-contained, `'static` owned view of a `OrderBookDelta` message.
2601
2602 Wraps [`::buffa::OwnedView`]`<`[`OrderBookDeltaView`]`<'static>>`: the decoded view and the [`::buffa::bytes::Bytes`] buffer it borrows from travel together, so the handle is `'static` and `Send + Sync` — suitable for async handlers, spawned tasks, and anywhere a `'static` bound is required.
2603
2604 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`OrderBookDeltaView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
2605        #[derive(Clone, Debug)]
2606        pub struct OrderBookDeltaOwnedView(
2607            ::buffa::OwnedView<OrderBookDeltaView<'static>>,
2608        );
2609        impl OrderBookDeltaOwnedView {
2610            /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
2611            ///
2612            /// The view borrows directly from the buffer's data; the buffer is
2613            /// retained inside the returned handle.
2614            ///
2615            /// # Errors
2616            ///
2617            /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
2618            /// protobuf data.
2619            pub fn decode(
2620                bytes: ::buffa::bytes::Bytes,
2621            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2622                ::core::result::Result::Ok(
2623                    OrderBookDeltaOwnedView(::buffa::OwnedView::decode(bytes)?),
2624                )
2625            }
2626            /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
2627            /// max message size).
2628            ///
2629            /// # Errors
2630            ///
2631            /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
2632            /// exceeds the configured limits.
2633            pub fn decode_with_options(
2634                bytes: ::buffa::bytes::Bytes,
2635                opts: &::buffa::DecodeOptions,
2636            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2637                ::core::result::Result::Ok(
2638                    OrderBookDeltaOwnedView(
2639                        ::buffa::OwnedView::decode_with_options(bytes, opts)?,
2640                    ),
2641                )
2642            }
2643            /// Build from an owned message via an encode → decode round-trip.
2644            ///
2645            /// # Errors
2646            ///
2647            /// Returns [`::buffa::DecodeError`] if the re-encoded bytes are
2648            /// somehow invalid (should not happen for well-formed messages).
2649            pub fn from_owned(
2650                msg: &super::super::OrderBookDelta,
2651            ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
2652                ::core::result::Result::Ok(
2653                    OrderBookDeltaOwnedView(::buffa::OwnedView::from_owned(msg)?),
2654                )
2655            }
2656            /// Borrow the full [`OrderBookDeltaView`] with its lifetime tied to `&self`.
2657            #[must_use]
2658            pub fn view(&self) -> &OrderBookDeltaView<'_> {
2659                self.0.reborrow()
2660            }
2661            /// Convert to the owned message type.
2662            ///
2663            /// # Errors
2664            ///
2665            /// Returns an error if re-materializing preserved unknown fields
2666            /// fails (e.g. the unknown-field limit is exceeded).
2667            pub fn to_owned_message(
2668                &self,
2669            ) -> ::core::result::Result<
2670                super::super::OrderBookDelta,
2671                ::buffa::DecodeError,
2672            > {
2673                self.0.to_owned_message()
2674            }
2675            /// The underlying bytes buffer.
2676            #[must_use]
2677            pub fn bytes(&self) -> &::buffa::bytes::Bytes {
2678                self.0.bytes()
2679            }
2680            /// Consume the handle, returning the underlying bytes buffer.
2681            #[must_use]
2682            pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
2683                self.0.into_bytes()
2684            }
2685            /// Numeric symbol identifier.
2686            ///
2687            /// Field 1: `symbol_id`
2688            #[must_use]
2689            pub fn symbol_id(&self) -> u32 {
2690                self.0.reborrow().symbol_id
2691            }
2692            /// Monotonic book sequence range covered by this update.
2693            /// When reset=true, book_seq_start may be 0.
2694            ///
2695            /// Field 2: `book_seq_start`
2696            #[must_use]
2697            pub fn book_seq_start(&self) -> u64 {
2698                self.0.reborrow().book_seq_start
2699            }
2700            /// Monotonic book sequence at the end of this update's range. Consumers can
2701            /// retain it as the last applied sequence and ignore updates that do not advance it.
2702            ///
2703            /// Field 3: `book_seq_end`
2704            #[must_use]
2705            pub fn book_seq_end(&self) -> u64 {
2706                self.0.reborrow().book_seq_end
2707            }
2708            /// Bid-side updates (SET semantics at price_ticks).
2709            ///
2710            /// Field 4: `bids`
2711            #[must_use]
2712            pub fn bids(
2713                &self,
2714            ) -> &::buffa::RepeatedView<
2715                '_,
2716                super::super::__buffa::view::PriceLevelView<'_>,
2717            > {
2718                &self.0.reborrow().bids
2719            }
2720            /// Ask-side updates (SET semantics at price_ticks).
2721            ///
2722            /// Field 5: `asks`
2723            #[must_use]
2724            pub fn asks(
2725                &self,
2726            ) -> &::buffa::RepeatedView<
2727                '_,
2728                super::super::__buffa::view::PriceLevelView<'_>,
2729            > {
2730                &self.0.reborrow().asks
2731            }
2732            /// If true, consumers should clear their local book state before applying
2733            /// updates.
2734            ///
2735            /// Field 6: `reset`
2736            #[must_use]
2737            pub fn reset(&self) -> bool {
2738                self.0.reborrow().reset
2739            }
2740            /// Timestamp associated with this update (best-effort).
2741            ///
2742            /// Field 7: `ts`
2743            #[must_use]
2744            pub fn ts(
2745                &self,
2746            ) -> &::buffa::MessageFieldView<
2747                ::buffa_types::google::protobuf::__buffa::view::TimestampView<'_>,
2748            > {
2749                &self.0.reborrow().ts
2750            }
2751        }
2752        impl ::core::convert::From<::buffa::OwnedView<OrderBookDeltaView<'static>>>
2753        for OrderBookDeltaOwnedView {
2754            fn from(inner: ::buffa::OwnedView<OrderBookDeltaView<'static>>) -> Self {
2755                OrderBookDeltaOwnedView(inner)
2756            }
2757        }
2758        impl ::core::convert::From<OrderBookDeltaOwnedView>
2759        for ::buffa::OwnedView<OrderBookDeltaView<'static>> {
2760            fn from(wrapper: OrderBookDeltaOwnedView) -> Self {
2761                wrapper.0
2762            }
2763        }
2764        impl ::core::convert::AsRef<::buffa::OwnedView<OrderBookDeltaView<'static>>>
2765        for OrderBookDeltaOwnedView {
2766            fn as_ref(&self) -> &::buffa::OwnedView<OrderBookDeltaView<'static>> {
2767                &self.0
2768            }
2769        }
2770        impl ::buffa::HasMessageView for super::super::OrderBookDelta {
2771            type View<'a> = OrderBookDeltaView<'a>;
2772            type ViewHandle = OrderBookDeltaOwnedView;
2773        }
2774        impl ::serde::Serialize for OrderBookDeltaOwnedView {
2775            fn serialize<__S: ::serde::Serializer>(
2776                &self,
2777                __s: __S,
2778            ) -> ::core::result::Result<__S::Ok, __S::Error> {
2779                ::serde::Serialize::serialize(&self.0, __s)
2780            }
2781        }
2782    }
2783    /// Register this package's `Any` type entries and extension entries.
2784    pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) {
2785        reg.register_json_any(super::__GET_ORDER_BOOK_REQUEST_JSON_ANY);
2786        reg.register_json_any(super::__PRICE_LEVEL_JSON_ANY);
2787        reg.register_json_any(super::__GET_ORDER_BOOK_RESPONSE_JSON_ANY);
2788        reg.register_json_any(super::__ORDER_BOOK_DELTA_JSON_ANY);
2789    }
2790}
2791#[doc(inline)]
2792pub use self::__buffa::view::GetOrderBookRequestView;
2793#[doc(inline)]
2794pub use self::__buffa::view::GetOrderBookRequestOwnedView;
2795#[doc(inline)]
2796pub use self::__buffa::view::PriceLevelView;
2797#[doc(inline)]
2798pub use self::__buffa::view::PriceLevelOwnedView;
2799#[doc(inline)]
2800pub use self::__buffa::view::GetOrderBookResponseView;
2801#[doc(inline)]
2802pub use self::__buffa::view::GetOrderBookResponseOwnedView;
2803#[doc(inline)]
2804pub use self::__buffa::view::OrderBookDeltaView;
2805#[doc(inline)]
2806pub use self::__buffa::view::OrderBookDeltaOwnedView;
2807#[doc(inline)]
2808pub use self::__buffa::register_types;