pub trait Bo4eObject: Sealed {
type BoTyp;
// Required methods
fn bo_type(&self) -> Self::BoTyp;
fn schema_version(&self) -> &'static str;
}versioned only.Expand description
Marker trait implemented by every generated BO4E business object (Geschäftsobjekt).
Provides runtime access to the BO type discriminant and the schema version that was used to generate this type. COM types and enums do NOT implement this trait.
§Sealed trait
Bo4eObject is sealed — it cannot be implemented by types outside this crate.
This allows the library to add new methods in future releases without breaking
downstream code that merely uses the trait.
§Design note — associated type over bare return type
bo_type() returns Self::BoTyp (an associated type) so that the single trait
definition in src/lib.rs can serve all schema versions while keeping each
version’s BoTyp enum strongly typed. For dyn usage, bind the associated type:
use rubo4e::v202607::BoTyp;
let objects: Vec<Box<dyn rubo4e::Bo4eObject<BoTyp = BoTyp>>> = vec![
Box::new(Vertrag::default()),
Box::new(Marktlokation::default()),
];
for obj in &objects {
println!("{:?} schema={}", obj.bo_type(), obj.schema_version());
}§Example
use rubo4e::prelude::*;
let v = Vertrag::default();
assert_eq!(v.bo_type(), BoTyp::Vertrag);
assert_eq!(v.schema_version(), "v202607.0.0");Required Associated Types§
Required Methods§
Sourcefn bo_type(&self) -> Self::BoTyp
fn bo_type(&self) -> Self::BoTyp
Returns the Self::BoTyp discriminant identifying this business object.
Sourcefn schema_version(&self) -> &'static str
fn schema_version(&self) -> &'static str
Returns the BO4E schema version tag used to generate this type (e.g. "v202607.0.0").
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".