osmflow 0.13.1

Fast, parallel reading of OpenStreetMap PBF files, and node location stores, from a city extract to the planet
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
// @generated by buffa-codegen. DO NOT EDIT.
// source: fileformat.proto

/// protoc --java_out=../.. fileformat.proto
///
///  STORAGE LAYER: Storing primitives.
#[derive(Clone, Debug, Default)]
pub struct BlobView<'a> {
    /// When compressed, the uncompressed size
    ///
    /// Field 2: `raw_size`
    pub raw_size: ::core::option::Option<i32>,
    pub data: ::core::option::Option<super::super::__buffa::view::oneof::blob::Data<'a>>,
}
impl<'a> ::buffa::MessageView<'a> for BlobView<'a> {
    type Owned = super::super::Blob;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
        let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
        <Self as ::buffa::MessageView>::decode_view_ctx(
            buf,
            ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
                .with_element_memory(&__elem),
        )
    }
    fn decode_view_with_ctx(
        buf: &'a [u8],
        ctx: ::buffa::DecodeContext<'_>,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
    }
    #[inline]
    fn merge_view_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        cur: &'a [u8],
        _before_tag: &'a [u8],
        ctx: ::buffa::DecodeContext<'_>,
    ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
        let _ = ctx;
        #[allow(unused_variables)]
        let view = self;
        let mut cur = cur;
        match tag.field_number() {
            2u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                view.raw_size = Some(::buffa::types::decode_int32(&mut cur)?);
            }
            1u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                view.data = Some(
                    super::super::__buffa::view::oneof::blob::Data::Raw(
                        ::buffa::types::borrow_bytes(&mut cur)?,
                    ),
                );
            }
            3u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                view.data = Some(
                    super::super::__buffa::view::oneof::blob::Data::ZlibData(
                        ::buffa::types::borrow_bytes(&mut cur)?,
                    ),
                );
            }
            4u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                view.data = Some(
                    super::super::__buffa::view::oneof::blob::Data::LzmaData(
                        ::buffa::types::borrow_bytes(&mut cur)?,
                    ),
                );
            }
            5u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                view.data = Some(
                    super::super::__buffa::view::oneof::blob::Data::OBSOLETEBzip2Data(
                        ::buffa::types::borrow_bytes(&mut cur)?,
                    ),
                );
            }
            6u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                view.data = Some(
                    super::super::__buffa::view::oneof::blob::Data::Lz4Data(
                        ::buffa::types::borrow_bytes(&mut cur)?,
                    ),
                );
            }
            7u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                view.data = Some(
                    super::super::__buffa::view::oneof::blob::Data::ZstdData(
                        ::buffa::types::borrow_bytes(&mut cur)?,
                    ),
                );
            }
            _ => {
                ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
            }
        }
        ::core::result::Result::Ok(cur)
    }
    fn to_owned_message(
        &self,
    ) -> ::core::result::Result<super::super::Blob, ::buffa::DecodeError> {
        self.to_owned_from_source(None)
    }
    #[allow(clippy::useless_conversion, clippy::needless_update)]
    fn to_owned_from_source(
        &self,
        __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
    ) -> ::core::result::Result<super::super::Blob, ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        let _ = __buffa_src;
        ::core::result::Result::Ok(super::super::Blob {
            raw_size: self.raw_size,
            data: self
                .data
                .as_ref()
                .map(|v| match v {
                    super::super::__buffa::view::oneof::blob::Data::Raw(v) => {
                        super::super::__buffa::oneof::blob::Data::Raw((v).to_vec())
                    }
                    super::super::__buffa::view::oneof::blob::Data::ZlibData(v) => {
                        super::super::__buffa::oneof::blob::Data::ZlibData((v).to_vec())
                    }
                    super::super::__buffa::view::oneof::blob::Data::LzmaData(v) => {
                        super::super::__buffa::oneof::blob::Data::LzmaData((v).to_vec())
                    }
                    super::super::__buffa::view::oneof::blob::Data::OBSOLETEBzip2Data(
                        v,
                    ) => {
                        super::super::__buffa::oneof::blob::Data::OBSOLETEBzip2Data(
                            (v).to_vec(),
                        )
                    }
                    super::super::__buffa::view::oneof::blob::Data::Lz4Data(v) => {
                        super::super::__buffa::oneof::blob::Data::Lz4Data((v).to_vec())
                    }
                    super::super::__buffa::view::oneof::blob::Data::ZstdData(v) => {
                        super::super::__buffa::oneof::blob::Data::ZstdData((v).to_vec())
                    }
                }),
            ..::core::default::Default::default()
        })
    }
}
impl<'a> ::buffa::ViewEncode<'a> for BlobView<'a> {
    #[allow(clippy::needless_borrow, clippy::let_and_return)]
    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u64;
        if let ::core::option::Option::Some(ref v) = self.data {
            match v {
                super::super::__buffa::view::oneof::blob::Data::Raw(x) => {
                    size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64;
                }
                super::super::__buffa::view::oneof::blob::Data::ZlibData(x) => {
                    size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64;
                }
                super::super::__buffa::view::oneof::blob::Data::LzmaData(x) => {
                    size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64;
                }
                super::super::__buffa::view::oneof::blob::Data::OBSOLETEBzip2Data(x) => {
                    size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64;
                }
                super::super::__buffa::view::oneof::blob::Data::Lz4Data(x) => {
                    size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64;
                }
                super::super::__buffa::view::oneof::blob::Data::ZstdData(x) => {
                    size += 1u64 + ::buffa::types::bytes_encoded_len(x) as u64;
                }
            }
        }
        if let Some(v) = self.raw_size {
            size += 1u64 + ::buffa::types::int32_encoded_len(v) as u64;
        }
        ::buffa::saturate_size(size)
    }
    #[allow(clippy::needless_borrow)]
    fn write_to(
        &self,
        _cache: &mut ::buffa::SizeCache,
        buf: &mut impl ::buffa::EncodeSink,
    ) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        if let ::core::option::Option::Some(ref v) = self.data {
            match v {
                super::super::__buffa::view::oneof::blob::Data::Raw(x) => {
                    ::buffa::types::put_shared_bytes_field(1u32, x, buf);
                }
                super::super::__buffa::view::oneof::blob::Data::ZlibData(x) => {
                    ::buffa::types::put_shared_bytes_field(3u32, x, buf);
                }
                super::super::__buffa::view::oneof::blob::Data::LzmaData(x) => {
                    ::buffa::types::put_shared_bytes_field(4u32, x, buf);
                }
                super::super::__buffa::view::oneof::blob::Data::OBSOLETEBzip2Data(x) => {
                    ::buffa::types::put_shared_bytes_field(5u32, x, buf);
                }
                super::super::__buffa::view::oneof::blob::Data::Lz4Data(x) => {
                    ::buffa::types::put_shared_bytes_field(6u32, x, buf);
                }
                super::super::__buffa::view::oneof::blob::Data::ZstdData(x) => {
                    ::buffa::types::put_shared_bytes_field(7u32, x, buf);
                }
            }
        }
        if let Some(v) = self.raw_size {
            ::buffa::types::put_int32_field(2u32, v, buf);
        }
    }
}
impl<'a> ::buffa::MessageName for BlobView<'a> {
    const PACKAGE: &'static str = "OSMPBF";
    const NAME: &'static str = "Blob";
    const FULL_NAME: &'static str = "OSMPBF.Blob";
    const TYPE_URL: &'static str = "type.googleapis.com/OSMPBF.Blob";
}
::buffa::impl_default_view_instance!(BlobView);
::buffa::impl_view_reborrow!(BlobView);
/** Self-contained, `'static` owned view of a `Blob` message.

 Wraps [`::buffa::OwnedView`]`<`[`BlobView`]`<'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.

 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`BlobView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
#[derive(Clone, Debug)]
pub struct BlobOwnedView(::buffa::OwnedView<BlobView<'static>>);
impl BlobOwnedView {
    /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
    ///
    /// The view borrows directly from the buffer's data; the buffer is
    /// retained inside the returned handle.
    ///
    /// # Errors
    ///
    /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
    /// protobuf data.
    pub fn decode(
        bytes: ::buffa::bytes::Bytes,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        ::core::result::Result::Ok(BlobOwnedView(::buffa::OwnedView::decode(bytes)?))
    }
    /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
    /// max message size).
    ///
    /// # Errors
    ///
    /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
    /// exceeds the configured limits.
    pub fn decode_with_options(
        bytes: ::buffa::bytes::Bytes,
        opts: &::buffa::DecodeOptions,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        ::core::result::Result::Ok(
            BlobOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
        )
    }
    /// Build from an owned message via an encode → decode round-trip.
    ///
    /// # Errors
    ///
    /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the
    /// message's encoded size exceeds the 2 GiB protobuf limit, or
    /// another [`::buffa::DecodeError`] if the re-encoded bytes are
    /// somehow invalid (should not happen for well-formed messages).
    pub fn from_owned(
        msg: &super::super::Blob,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        ::core::result::Result::Ok(BlobOwnedView(::buffa::OwnedView::from_owned(msg)?))
    }
    /// Borrow the full [`BlobView`] with its lifetime tied to `&self`.
    #[must_use]
    pub fn view(&self) -> &BlobView<'_> {
        self.0.reborrow()
    }
    /// Convert to the owned message type.
    ///
    /// Infallible: this type's constructors wire-decode their
    /// buffer, and a view produced by wire decoding always
    /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`],
    /// whose contract also governs handles converted from a raw
    /// [`::buffa::OwnedView`].
    #[must_use]
    pub fn to_owned_message(&self) -> super::super::Blob {
        self.0.to_owned_message()
    }
    /// The underlying bytes buffer.
    #[must_use]
    pub fn bytes(&self) -> &::buffa::bytes::Bytes {
        self.0.bytes()
    }
    /// Consume the handle, returning the underlying bytes buffer.
    #[must_use]
    pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
        self.0.into_bytes()
    }
    /// When compressed, the uncompressed size
    ///
    /// Field 2: `raw_size`
    #[must_use]
    pub fn raw_size(&self) -> ::core::option::Option<i32> {
        self.0.reborrow().raw_size
    }
    /// Oneof `data`.
    #[must_use]
    pub fn data(
        &self,
    ) -> ::core::option::Option<&super::super::__buffa::view::oneof::blob::Data<'_>> {
        self.0.reborrow().data.as_ref()
    }
}
impl ::core::convert::From<::buffa::OwnedView<BlobView<'static>>> for BlobOwnedView {
    fn from(inner: ::buffa::OwnedView<BlobView<'static>>) -> Self {
        BlobOwnedView(inner)
    }
}
impl ::core::convert::From<BlobOwnedView> for ::buffa::OwnedView<BlobView<'static>> {
    fn from(wrapper: BlobOwnedView) -> Self {
        wrapper.0
    }
}
impl ::core::convert::AsRef<::buffa::OwnedView<BlobView<'static>>> for BlobOwnedView {
    fn as_ref(&self) -> &::buffa::OwnedView<BlobView<'static>> {
        &self.0
    }
}
impl ::buffa::HasMessageView for super::super::Blob {
    type View<'a> = BlobView<'a>;
    type ViewHandle = BlobOwnedView;
}
/// A file contains an sequence of fileblock headers, each prefixed by
/// their length in network byte order, followed by a data block
/// containing the actual data. Types starting with a "_" are reserved.
#[derive(Clone, Debug, Default)]
pub struct BlobHeaderView<'a> {
    /// Field 1: `type`
    pub r#type: &'a str,
    /// Field 2: `indexdata`
    pub indexdata: ::core::option::Option<&'a [u8]>,
    /// Field 3: `datasize`
    pub datasize: i32,
    #[doc(hidden)]
    pub __buffa_required_seen_0: u64,
}
impl<'a> BlobHeaderView<'a> {
    /**Whether required field `type` was present on the wire.

Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/
    #[must_use]
    #[inline]
    pub const fn has_type(&self) -> bool {
        self.__buffa_required_seen_0 & 1u64 != 0
    }
    /**Whether required field `datasize` was present on the wire.

Distinguishes a field that was absent from one explicitly encoded with its default value (required scalar fields are stored as bare, non-`Option` types, so the value alone cannot tell the two apart). Presence is recorded only by the wire decoder: a default or hand-built view reports `false`. Encoding is unaffected — required fields are always written.*/
    #[must_use]
    #[inline]
    pub const fn has_datasize(&self) -> bool {
        self.__buffa_required_seen_0 & 2u64 != 0
    }
}
impl<'a> ::buffa::MessageView<'a> for BlobHeaderView<'a> {
    type Owned = super::super::BlobHeader;
    fn decode_view(buf: &'a [u8]) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        let __limit = ::core::cell::Cell::new(::buffa::DEFAULT_UNKNOWN_FIELD_LIMIT);
        let __elem = ::core::cell::Cell::new(::buffa::DEFAULT_ELEMENT_MEMORY_LIMIT);
        <Self as ::buffa::MessageView>::decode_view_ctx(
            buf,
            ::buffa::DecodeContext::new(::buffa::RECURSION_LIMIT, &__limit)
                .with_element_memory(&__elem),
        )
    }
    fn decode_view_with_ctx(
        buf: &'a [u8],
        ctx: ::buffa::DecodeContext<'_>,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        <Self as ::buffa::MessageView>::decode_view_ctx(buf, ctx)
    }
    #[inline]
    fn merge_view_field(
        &mut self,
        tag: ::buffa::encoding::Tag,
        cur: &'a [u8],
        _before_tag: &'a [u8],
        ctx: ::buffa::DecodeContext<'_>,
    ) -> ::core::result::Result<&'a [u8], ::buffa::DecodeError> {
        let _ = ctx;
        #[allow(unused_variables)]
        let view = self;
        let mut cur = cur;
        match tag.field_number() {
            1u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                view.r#type = ::buffa::types::borrow_str(&mut cur)?;
                view.__buffa_required_seen_0 |= 1u64;
            }
            2u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::LengthDelimited,
                )?;
                view.indexdata = Some(::buffa::types::borrow_bytes(&mut cur)?);
            }
            3u32 => {
                ::buffa::encoding::check_wire_type(
                    tag,
                    ::buffa::encoding::WireType::Varint,
                )?;
                view.datasize = ::buffa::types::decode_int32(&mut cur)?;
                view.__buffa_required_seen_0 |= 2u64;
            }
            _ => {
                ::buffa::encoding::skip_field_depth(tag, &mut cur, ctx.depth())?;
            }
        }
        ::core::result::Result::Ok(cur)
    }
    fn to_owned_message(
        &self,
    ) -> ::core::result::Result<super::super::BlobHeader, ::buffa::DecodeError> {
        self.to_owned_from_source(None)
    }
    #[allow(clippy::useless_conversion, clippy::needless_update)]
    fn to_owned_from_source(
        &self,
        __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
    ) -> ::core::result::Result<super::super::BlobHeader, ::buffa::DecodeError> {
        #[allow(unused_imports)]
        use ::buffa::alloc::string::ToString as _;
        let _ = __buffa_src;
        ::core::result::Result::Ok(super::super::BlobHeader {
            r#type: self.r#type.to_string(),
            indexdata: self.indexdata.map(|b| (b).to_vec()),
            datasize: self.datasize,
            ..::core::default::Default::default()
        })
    }
}
impl<'a> ::buffa::ViewEncode<'a> for BlobHeaderView<'a> {
    #[allow(clippy::needless_borrow, clippy::let_and_return)]
    fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        let mut size = 0u64;
        size += 1u64 + ::buffa::types::string_encoded_len(&self.r#type) as u64;
        if let Some(ref v) = self.indexdata {
            size += 1u64 + ::buffa::types::bytes_encoded_len(v) as u64;
        }
        size += 1u64 + ::buffa::types::int32_encoded_len(self.datasize) as u64;
        ::buffa::saturate_size(size)
    }
    #[allow(clippy::needless_borrow)]
    fn write_to(
        &self,
        _cache: &mut ::buffa::SizeCache,
        buf: &mut impl ::buffa::EncodeSink,
    ) {
        #[allow(unused_imports)]
        use ::buffa::Enumeration as _;
        ::buffa::types::put_string_field(1u32, &self.r#type, buf);
        if let Some(ref v) = self.indexdata {
            ::buffa::types::put_shared_bytes_field(2u32, v, buf);
        }
        ::buffa::types::put_int32_field(3u32, self.datasize, buf);
    }
}
impl<'a> ::buffa::MessageName for BlobHeaderView<'a> {
    const PACKAGE: &'static str = "OSMPBF";
    const NAME: &'static str = "BlobHeader";
    const FULL_NAME: &'static str = "OSMPBF.BlobHeader";
    const TYPE_URL: &'static str = "type.googleapis.com/OSMPBF.BlobHeader";
}
::buffa::impl_default_view_instance!(BlobHeaderView);
::buffa::impl_view_reborrow!(BlobHeaderView);
/** Self-contained, `'static` owned view of a `BlobHeader` message.

 Wraps [`::buffa::OwnedView`]`<`[`BlobHeaderView`]`<'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.

 Field accessors return borrows tied to `&self`. Use [`Self::view`] to get the full [`BlobHeaderView`] when you need struct patterns, iteration helpers, or to pass the view to lifetime-parameterised code.*/
#[derive(Clone, Debug)]
pub struct BlobHeaderOwnedView(::buffa::OwnedView<BlobHeaderView<'static>>);
impl BlobHeaderOwnedView {
    /// Decode an owned view from a [`::buffa::bytes::Bytes`] buffer.
    ///
    /// The view borrows directly from the buffer's data; the buffer is
    /// retained inside the returned handle.
    ///
    /// # Errors
    ///
    /// Returns [`::buffa::DecodeError`] if the buffer contains invalid
    /// protobuf data.
    pub fn decode(
        bytes: ::buffa::bytes::Bytes,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        ::core::result::Result::Ok(
            BlobHeaderOwnedView(::buffa::OwnedView::decode(bytes)?),
        )
    }
    /// Decode with custom [`::buffa::DecodeOptions`] (recursion limit,
    /// max message size).
    ///
    /// # Errors
    ///
    /// Returns [`::buffa::DecodeError`] if the buffer is invalid or
    /// exceeds the configured limits.
    pub fn decode_with_options(
        bytes: ::buffa::bytes::Bytes,
        opts: &::buffa::DecodeOptions,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        ::core::result::Result::Ok(
            BlobHeaderOwnedView(::buffa::OwnedView::decode_with_options(bytes, opts)?),
        )
    }
    /// Build from an owned message via an encode → decode round-trip.
    ///
    /// # Errors
    ///
    /// Returns [`::buffa::DecodeError::MessageTooLarge`] if the
    /// message's encoded size exceeds the 2 GiB protobuf limit, or
    /// another [`::buffa::DecodeError`] if the re-encoded bytes are
    /// somehow invalid (should not happen for well-formed messages).
    pub fn from_owned(
        msg: &super::super::BlobHeader,
    ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
        ::core::result::Result::Ok(
            BlobHeaderOwnedView(::buffa::OwnedView::from_owned(msg)?),
        )
    }
    /// Borrow the full [`BlobHeaderView`] with its lifetime tied to `&self`.
    #[must_use]
    pub fn view(&self) -> &BlobHeaderView<'_> {
        self.0.reborrow()
    }
    /// Convert to the owned message type.
    ///
    /// Infallible: this type's constructors wire-decode their
    /// buffer, and a view produced by wire decoding always
    /// converts. Delegates to [`::buffa::OwnedView::to_owned_message`],
    /// whose contract also governs handles converted from a raw
    /// [`::buffa::OwnedView`].
    #[must_use]
    pub fn to_owned_message(&self) -> super::super::BlobHeader {
        self.0.to_owned_message()
    }
    /// The underlying bytes buffer.
    #[must_use]
    pub fn bytes(&self) -> &::buffa::bytes::Bytes {
        self.0.bytes()
    }
    /// Consume the handle, returning the underlying bytes buffer.
    #[must_use]
    pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
        self.0.into_bytes()
    }
    /// Field 1: `type`
    #[must_use]
    pub fn r#type(&self) -> &'_ str {
        self.0.reborrow().r#type
    }
    /// Field 2: `indexdata`
    #[must_use]
    pub fn indexdata(&self) -> ::core::option::Option<&'_ [u8]> {
        self.0.reborrow().indexdata
    }
    /// Field 3: `datasize`
    #[must_use]
    pub fn datasize(&self) -> i32 {
        self.0.reborrow().datasize
    }
}
impl ::core::convert::From<::buffa::OwnedView<BlobHeaderView<'static>>>
for BlobHeaderOwnedView {
    fn from(inner: ::buffa::OwnedView<BlobHeaderView<'static>>) -> Self {
        BlobHeaderOwnedView(inner)
    }
}
impl ::core::convert::From<BlobHeaderOwnedView>
for ::buffa::OwnedView<BlobHeaderView<'static>> {
    fn from(wrapper: BlobHeaderOwnedView) -> Self {
        wrapper.0
    }
}
impl ::core::convert::AsRef<::buffa::OwnedView<BlobHeaderView<'static>>>
for BlobHeaderOwnedView {
    fn as_ref(&self) -> &::buffa::OwnedView<BlobHeaderView<'static>> {
        &self.0
    }
}
impl ::buffa::HasMessageView for super::super::BlobHeader {
    type View<'a> = BlobHeaderView<'a>;
    type ViewHandle = BlobHeaderOwnedView;
}