objects/
lib.rs

1// Copyright 2023 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5pub mod folder_listing;
6
7/// The error type used throughout this library.
8mod error;
9pub use error::Error as ObexObjectError;
10
11/// A builder type can build a Document Type object into raw bytes of encoded data.
12pub trait Builder {
13    type Error;
14
15    // Returns the MIME type of the raw bytes of data.
16    fn mime_type(&self) -> String;
17
18    /// Builds self into raw bytes of the specific Document Type.
19    fn build<W: std::io::Write>(&self, buf: W) -> ::core::result::Result<(), Self::Error>;
20}
21
22/// An parser type can parse objects from raw bytes of encoded data.
23pub trait Parser: ::core::marker::Sized {
24    type Error;
25
26    /// Parses from raw bytes of a specific Document Type into specific object, or returns an error.
27    fn parse<R: std::io::prelude::Read>(buf: R) -> Result<Self, Self::Error>;
28}