Translate inventory parity tests
This commit is contained in:
@@ -143,6 +143,77 @@ pub use libremetaverse_structured_data as structured_data;
|
||||
pub use libremetaverse_types as types;
|
||||
pub use libremetaverse_types::Error;
|
||||
|
||||
/// Rust object-safe view of the C# `InventoryBase` inheritance hierarchy.
|
||||
pub trait InventoryObjectClass: std::any::Any {
|
||||
/// Returns the concrete value for exact C# runtime-type checks.
|
||||
fn as_any(&self) -> &dyn std::any::Any;
|
||||
|
||||
/// Returns the shared `InventoryBase` portion of the concrete object.
|
||||
fn inventory_base(&self) -> &InventoryBase;
|
||||
}
|
||||
|
||||
/// Rust object-safe view of concrete classes derived from C# `InventoryItem`.
|
||||
pub trait InventoryItemClass: InventoryObjectClass {}
|
||||
|
||||
macro_rules! inventory_object_class {
|
||||
($type:ty, $base:ident $(.$nested:ident)*) => {
|
||||
impl InventoryObjectClass for $type {
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn inventory_base(&self) -> &InventoryBase {
|
||||
&self.$base$(.$nested)*
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
impl InventoryObjectClass for InventoryBase {
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
||||
fn inventory_base(&self) -> &InventoryBase {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
inventory_object_class!(InventoryFolder, base);
|
||||
inventory_object_class!(InventoryItem, base);
|
||||
inventory_object_class!(InventoryAnimation, base.base);
|
||||
inventory_object_class!(InventoryAttachment, base.base);
|
||||
inventory_object_class!(InventoryCallingCard, base.base);
|
||||
inventory_object_class!(InventoryCategory, base.base);
|
||||
inventory_object_class!(InventoryGesture, base.base);
|
||||
inventory_object_class!(InventoryLSL, base.base);
|
||||
inventory_object_class!(InventoryLandmark, base.base);
|
||||
inventory_object_class!(InventoryMaterial, base.base);
|
||||
inventory_object_class!(InventoryNotecard, base.base);
|
||||
inventory_object_class!(InventoryObject, base.base);
|
||||
inventory_object_class!(InventorySettings, base.base);
|
||||
inventory_object_class!(InventorySnapshot, base.base);
|
||||
inventory_object_class!(InventorySound, base.base);
|
||||
inventory_object_class!(InventoryTexture, base.base);
|
||||
inventory_object_class!(InventoryWearable, base.base);
|
||||
|
||||
impl InventoryItemClass for InventoryItem {}
|
||||
impl InventoryItemClass for InventoryAnimation {}
|
||||
impl InventoryItemClass for InventoryAttachment {}
|
||||
impl InventoryItemClass for InventoryCallingCard {}
|
||||
impl InventoryItemClass for InventoryCategory {}
|
||||
impl InventoryItemClass for InventoryGesture {}
|
||||
impl InventoryItemClass for InventoryLSL {}
|
||||
impl InventoryItemClass for InventoryLandmark {}
|
||||
impl InventoryItemClass for InventoryMaterial {}
|
||||
impl InventoryItemClass for InventoryNotecard {}
|
||||
impl InventoryItemClass for InventoryObject {}
|
||||
impl InventoryItemClass for InventorySettings {}
|
||||
impl InventoryItemClass for InventorySnapshot {}
|
||||
impl InventoryItemClass for InventorySound {}
|
||||
impl InventoryItemClass for InventoryTexture {}
|
||||
impl InventoryItemClass for InventoryWearable {}
|
||||
|
||||
/// Project-owned boundary types for external `MessagePack` signatures.
|
||||
pub mod message_pack {
|
||||
pub trait IMessagePackFormatter<T = ()> {}
|
||||
|
||||
Reference in New Issue
Block a user