Standardize unimplemented API failures

This commit is contained in:
2026-08-08 11:44:46 +02:00
parent 3179d7a57d
commit d3f5e27f52
41 changed files with 1875 additions and 1608 deletions

View File

@@ -3,7 +3,7 @@
#![allow(non_camel_case_types)]
/// `enum` shim for C# `LibreMetaverse.AssetType`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct AssetType;
impl AssetType {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.AssetType";
@@ -11,7 +11,7 @@ impl AssetType {
}
/// `enum` shim for C# `LibreMetaverse.AttachmentPoint`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct AttachmentPoint;
impl AttachmentPoint {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.AttachmentPoint";
@@ -19,7 +19,7 @@ impl AttachmentPoint {
}
/// `class` shim for C# `LibreMetaverse.CRC32`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct CRC32;
impl CRC32 {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.CRC32";
@@ -27,7 +27,7 @@ impl CRC32 {
}
/// `class` shim for C# `LibreMetaverse.CacheDictionary`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct CacheDictionary<T0 = (), T1 = ()>(std::marker::PhantomData<(T0, T1)>);
impl<T0, T1> CacheDictionary<T0, T1> {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.CacheDictionary";
@@ -35,7 +35,7 @@ impl<T0, T1> CacheDictionary<T0, T1> {
}
/// `class` shim for C# `LibreMetaverse.CacheDictionaryEnumerator`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct CacheDictionaryEnumerator;
impl CacheDictionaryEnumerator {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.CacheDictionaryEnumerator";
@@ -43,7 +43,7 @@ impl CacheDictionaryEnumerator {
}
/// `enum` shim for C# `LibreMetaverse.ClickAction`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ClickAction;
impl ClickAction {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.ClickAction";
@@ -51,7 +51,7 @@ impl ClickAction {
}
/// `struct` shim for C# `LibreMetaverse.Color4`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Color4;
impl Color4 {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.Color4";
@@ -59,7 +59,7 @@ impl Color4 {
}
/// `class` shim for C# `LibreMetaverse.DoubleDictionary`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct DoubleDictionary<T0 = (), T1 = (), T2 = ()>(std::marker::PhantomData<(T0, T1, T2)>);
impl<T0, T1, T2> DoubleDictionary<T0, T1, T2> {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.DoubleDictionary";
@@ -67,7 +67,7 @@ impl<T0, T1, T2> DoubleDictionary<T0, T1, T2> {
}
/// `class` shim for C# `LibreMetaverse.EmptyRemovalStrategy`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct EmptyRemovalStrategy<T0 = ()>(std::marker::PhantomData<(T0,)>);
impl<T0> EmptyRemovalStrategy<T0> {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.EmptyRemovalStrategy";
@@ -75,7 +75,7 @@ impl<T0> EmptyRemovalStrategy<T0> {
}
/// `class` shim for C# `LibreMetaverse.EnumInfoAttribute`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct EnumInfoAttribute;
impl EnumInfoAttribute {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.EnumInfoAttribute";
@@ -83,7 +83,7 @@ impl EnumInfoAttribute {
}
/// `class` shim for C# `LibreMetaverse.EnumInfoExtensions`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct EnumInfoExtensions;
impl EnumInfoExtensions {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.EnumInfoExtensions";
@@ -91,7 +91,7 @@ impl EnumInfoExtensions {
}
/// `class` shim for C# `LibreMetaverse.ExpiringCache`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ExpiringCache<T0 = (), T1 = ()>(std::marker::PhantomData<(T0, T1)>);
impl<T0, T1> ExpiringCache<T0, T1> {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.ExpiringCache";
@@ -99,7 +99,7 @@ impl<T0, T1> ExpiringCache<T0, T1> {
}
/// `enum` shim for C# `LibreMetaverse.ExtraParamType`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ExtraParamType;
impl ExtraParamType {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.ExtraParamType";
@@ -107,7 +107,7 @@ impl ExtraParamType {
}
/// `enum` shim for C# `LibreMetaverse.FaceType`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct FaceType;
impl FaceType {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.FaceType";
@@ -115,7 +115,7 @@ impl FaceType {
}
/// `enum` shim for C# `LibreMetaverse.FolderType`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct FolderType;
impl FolderType {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.FolderType";
@@ -123,7 +123,7 @@ impl FolderType {
}
/// `enum` shim for C# `LibreMetaverse.HoleType`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct HoleType;
impl HoleType {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.HoleType";
@@ -136,7 +136,7 @@ pub trait ICacheDictionaryRemovalStrategy<T0 = ()> {
}
/// `enum` shim for C# `LibreMetaverse.InventoryType`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct InventoryType;
impl InventoryType {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.InventoryType";
@@ -144,7 +144,7 @@ impl InventoryType {
}
/// `enum` shim for C# `LibreMetaverse.JointType`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct JointType;
impl JointType {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.JointType";
@@ -152,7 +152,7 @@ impl JointType {
}
/// `class` shim for C# `LibreMetaverse.LruRemovalStrategy`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct LruRemovalStrategy<T0 = ()>(std::marker::PhantomData<(T0,)>);
impl<T0> LruRemovalStrategy<T0> {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.LruRemovalStrategy";
@@ -160,7 +160,7 @@ impl<T0> LruRemovalStrategy<T0> {
}
/// `enum` shim for C# `LibreMetaverse.Material`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Material;
impl Material {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.Material";
@@ -168,7 +168,7 @@ impl Material {
}
/// `struct` shim for C# `LibreMetaverse.Matrix4`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Matrix4;
impl Matrix4 {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.Matrix4";
@@ -176,7 +176,7 @@ impl Matrix4 {
}
/// `class` shim for C# `LibreMetaverse.MruRemovalStrategy`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct MruRemovalStrategy<T0 = ()>(std::marker::PhantomData<(T0,)>);
impl<T0> MruRemovalStrategy<T0> {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.MruRemovalStrategy";
@@ -184,7 +184,7 @@ impl<T0> MruRemovalStrategy<T0> {
}
/// `class` shim for C# `LibreMetaverse.MultiValueDictionary`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct MultiValueDictionary<T0 = (), T1 = ()>(std::marker::PhantomData<(T0, T1)>);
impl<T0, T1> MultiValueDictionary<T0, T1> {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.MultiValueDictionary";
@@ -192,7 +192,7 @@ impl<T0, T1> MultiValueDictionary<T0, T1> {
}
/// `enum` shim for C# `LibreMetaverse.ObjectCategory`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ObjectCategory;
impl ObjectCategory {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.ObjectCategory";
@@ -200,7 +200,7 @@ impl ObjectCategory {
}
/// `enum` shim for C# `LibreMetaverse.PCode`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct PCode;
impl PCode {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.PCode";
@@ -208,7 +208,7 @@ impl PCode {
}
/// `enum` shim for C# `LibreMetaverse.PathCurve`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct PathCurve;
impl PathCurve {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.PathCurve";
@@ -216,7 +216,7 @@ impl PathCurve {
}
/// `enum` shim for C# `LibreMetaverse.PhysicsShapeType`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct PhysicsShapeType;
impl PhysicsShapeType {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.PhysicsShapeType";
@@ -224,7 +224,7 @@ impl PhysicsShapeType {
}
/// `enum` shim for C# `LibreMetaverse.Platform`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Platform;
impl Platform {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.Platform";
@@ -232,7 +232,7 @@ impl Platform {
}
/// `enum` shim for C# `LibreMetaverse.PrimFlags`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct PrimFlags;
impl PrimFlags {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.PrimFlags";
@@ -240,7 +240,7 @@ impl PrimFlags {
}
/// `enum` shim for C# `LibreMetaverse.PrimType`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct PrimType;
impl PrimType {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.PrimType";
@@ -248,7 +248,7 @@ impl PrimType {
}
/// `enum` shim for C# `LibreMetaverse.ProfileCurve`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ProfileCurve;
impl ProfileCurve {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.ProfileCurve";
@@ -256,7 +256,7 @@ impl ProfileCurve {
}
/// `struct` shim for C# `LibreMetaverse.Quaternion`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Quaternion;
impl Quaternion {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.Quaternion";
@@ -264,7 +264,7 @@ impl Quaternion {
}
/// `struct` shim for C# `LibreMetaverse.Ray`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Ray;
impl Ray {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.Ray";
@@ -272,7 +272,7 @@ impl Ray {
}
/// `enum` shim for C# `LibreMetaverse.SaleType`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct SaleType;
impl SaleType {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.SaleType";
@@ -280,7 +280,7 @@ impl SaleType {
}
/// `enum` shim for C# `LibreMetaverse.SculptType`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct SculptType;
impl SculptType {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.SculptType";
@@ -288,7 +288,7 @@ impl SculptType {
}
/// `enum` shim for C# `LibreMetaverse.SoundFlags`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct SoundFlags;
impl SoundFlags {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.SoundFlags";
@@ -296,7 +296,7 @@ impl SoundFlags {
}
/// `class` shim for C# `LibreMetaverse.TokenBucket`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct TokenBucket;
impl TokenBucket {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.TokenBucket";
@@ -304,7 +304,7 @@ impl TokenBucket {
}
/// `record struct` shim for C# `LibreMetaverse.UUID`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct UUID;
impl UUID {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.UUID";
@@ -312,7 +312,7 @@ impl UUID {
}
/// `class` shim for C# `LibreMetaverse.Utils`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Utils;
impl Utils {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.Utils";
@@ -320,7 +320,7 @@ impl Utils {
}
/// `struct` shim for C# `LibreMetaverse.Vector2`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Vector2;
impl Vector2 {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.Vector2";
@@ -328,7 +328,7 @@ impl Vector2 {
}
/// `struct` shim for C# `LibreMetaverse.Vector3`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Vector3;
impl Vector3 {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.Vector3";
@@ -336,7 +336,7 @@ impl Vector3 {
}
/// `struct` shim for C# `LibreMetaverse.Vector3d`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Vector3d;
impl Vector3d {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.Vector3d";
@@ -344,7 +344,7 @@ impl Vector3d {
}
/// `struct` shim for C# `LibreMetaverse.Vector4`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Vector4;
impl Vector4 {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.Vector4";
@@ -352,7 +352,7 @@ impl Vector4 {
}
/// `enum` shim for C# `LibreMetaverse.WearableType`; members remain intentionally unimplemented.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct WearableType;
impl WearableType {
pub const CSHARP_NAME: &'static str = "LibreMetaverse.WearableType";

View File

@@ -1,5 +1,8 @@
//! Core value types corresponding to `LibreMetaverse.Types`.
mod generated;
pub mod shim;
pub use generated::*;
pub use shim::NotImplemented as Error;
pub use shim::{NotImplemented, not_implemented};

View File

@@ -0,0 +1,107 @@
//! Failure-only infrastructure for callable API shims.
//!
//! Fallible synchronous and asynchronous members return [`NotImplemented`].
//! Infallible members, trait methods, and constructors use
//! [`unimplemented_api!`](crate::unimplemented_api). Stream and callback
//! factories fail before returning a stream, registering a callback, or storing
//! a trait object; an empty stream or no-op callback would be plausible behavior.
use std::fmt;
const PANIC_PREFIX: &str = "unimplemented C# API member: ";
/// Typed failure returned by a fallible API shim.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct NotImplemented {
csharp_member: &'static str,
}
impl NotImplemented {
/// Creates a failure for one stable C# documentation ID.
#[must_use]
pub const fn new(csharp_member: &'static str) -> Self {
Self { csharp_member }
}
/// Returns the stable C# documentation ID of the unimplemented member.
#[must_use]
pub const fn csharp_member(self) -> &'static str {
self.csharp_member
}
}
impl fmt::Display for NotImplemented {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
formatter,
"C# API member {} is not implemented",
self.csharp_member
)
}
}
impl std::error::Error for NotImplemented {}
/// Returns the standardized typed failure without constructing a fake value.
///
/// # Errors
///
/// Always returns [`NotImplemented`] with the supplied stable C# member ID.
pub const fn not_implemented<T>(csharp_member: &'static str) -> Result<T, NotImplemented> {
Err(NotImplemented::new(csharp_member))
}
/// Panics for an infallible API whose signature cannot return [`NotImplemented`].
///
/// # Panics
///
/// Always, with a marker and the stable C# member ID.
#[doc(hidden)]
#[cold]
#[track_caller]
pub fn panic_unimplemented(csharp_member: &'static str) -> ! {
panic!("{PANIC_PREFIX}{csharp_member}")
}
/// Fails an infallible API shim with its stable C# documentation ID.
///
/// This is deliberately a panic rather than a default value. Translated tests
/// expecting a domain error therefore cannot mistake an unimplemented API for
/// the expected `Err` variant.
///
/// # Panics
///
/// Always, with the supplied stable C# member ID.
#[macro_export]
macro_rules! unimplemented_api {
($csharp_member:expr $(,)?) => {{ $crate::shim::panic_unimplemented($csharp_member) }};
}
#[cfg(test)]
mod tests {
use super::{NotImplemented, PANIC_PREFIX, not_implemented};
const MEMBER: &str = "M:LibreMetaverse.GridClient.Login(System.String)";
#[test]
fn error_formats_and_preserves_member_id() {
let error = NotImplemented::new(MEMBER);
assert_eq!(error.csharp_member(), MEMBER);
assert_eq!(
error.to_string(),
format!("C# API member {MEMBER} is not implemented")
);
assert_eq!(not_implemented::<bool>(MEMBER), Err(error));
}
#[test]
fn panic_placeholder_is_not_an_expected_error_result() {
let panic = std::panic::catch_unwind(|| crate::unimplemented_api!(MEMBER))
.expect_err("the infallible placeholder must panic");
let message = panic
.downcast_ref::<String>()
.expect("placeholder panic must retain its visible marker");
assert_eq!(message, &format!("{PANIC_PREFIX}{MEMBER}"));
assert!(not_implemented::<()>(MEMBER).is_err());
}
}