Translate types and utilities tests
Some checks failed
Rust API gates / api-gates (push) Has been cancelled
Some checks failed
Rust API gates / api-gates (push) Has been cancelled
This commit is contained in:
@@ -5,6 +5,10 @@
|
||||
//! ported.
|
||||
|
||||
use std::marker::PhantomData;
|
||||
use std::sync::{
|
||||
Arc,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
|
||||
pub trait Collection<T> {}
|
||||
|
||||
@@ -13,7 +17,21 @@ pub trait ReadWrite: std::io::Read + std::io::Write {}
|
||||
impl<T: std::io::Read + std::io::Write> ReadWrite for T {}
|
||||
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||
pub struct Object(u8);
|
||||
pub enum Object {
|
||||
String(String),
|
||||
}
|
||||
|
||||
impl From<String> for Object {
|
||||
fn from(value: String) -> Self {
|
||||
Self::String(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for Object {
|
||||
fn from(value: &str) -> Self {
|
||||
Self::String(value.to_owned())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
||||
pub struct Utf16CodeUnit(pub u16);
|
||||
@@ -63,13 +81,20 @@ pub struct XmlTextReader(pub String);
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct XmlTextWriter(pub String);
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
|
||||
pub struct CancellationToken;
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct CancellationToken(Arc<AtomicBool>);
|
||||
|
||||
impl CancellationToken {
|
||||
#[must_use]
|
||||
pub fn is_cancellation_requested(&self) -> bool {
|
||||
self.0.load(Ordering::Acquire)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
|
||||
pub struct Subscription;
|
||||
|
||||
pub struct EventHandler<T>(pub PhantomData<fn(T)>);
|
||||
pub type EventHandler<T> = Arc<dyn Fn(T) + Send + Sync>;
|
||||
|
||||
pub struct DictionaryKeys<TKey, TValue>(pub Vec<TKey>, pub PhantomData<fn(TValue)>);
|
||||
|
||||
@@ -77,9 +102,36 @@ pub struct DictionaryEntry(pub Object, pub Object);
|
||||
|
||||
pub struct RateLimitLease;
|
||||
|
||||
pub struct CancellationTokenSource;
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct CancellationTokenSource(CancellationToken);
|
||||
|
||||
pub trait Close {}
|
||||
impl CancellationTokenSource {
|
||||
#[must_use]
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn token(&self) -> CancellationToken {
|
||||
self.0.clone()
|
||||
}
|
||||
|
||||
pub fn cancel(&self) {
|
||||
self.0.0.store(true, Ordering::Release);
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Close {
|
||||
/// Releases the mapped disposable resource.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns the mapped disposal error, or an unimplemented error until the
|
||||
/// owning resource supplies its implementation.
|
||||
fn close(&mut self) -> Result<(), ExternalError> {
|
||||
Err(ExternalError("Close::close is not implemented".to_owned()))
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Thread;
|
||||
|
||||
|
||||
@@ -1216,6 +1216,7 @@ pub enum Material {
|
||||
}
|
||||
|
||||
/// C# type: `T:LibreMetaverse.Matrix4`.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Matrix4 {
|
||||
/// C# member: `F:LibreMetaverse.Matrix4.M11`.
|
||||
pub m11: f32,
|
||||
@@ -2163,6 +2164,7 @@ pub enum ProfileCurve {
|
||||
}
|
||||
|
||||
/// C# type: `T:LibreMetaverse.Quaternion`.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Quaternion {
|
||||
/// C# member: `F:LibreMetaverse.Quaternion.W`.
|
||||
pub w: f32,
|
||||
@@ -2654,6 +2656,7 @@ impl TokenBucket {
|
||||
}
|
||||
|
||||
/// C# type: `T:LibreMetaverse.UUID`.
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct UUID {
|
||||
bytes: [u8; 16],
|
||||
}
|
||||
@@ -3905,6 +3908,7 @@ impl Vector2 {
|
||||
}
|
||||
|
||||
/// C# type: `T:LibreMetaverse.Vector3`.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Vector3 {
|
||||
/// C# member: `F:LibreMetaverse.Vector3.X`.
|
||||
pub x: f32,
|
||||
@@ -4345,6 +4349,7 @@ impl Vector3 {
|
||||
}
|
||||
|
||||
/// C# type: `T:LibreMetaverse.Vector3d`.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Vector3d {
|
||||
/// C# member: `F:LibreMetaverse.Vector3d.X`.
|
||||
pub x: f64,
|
||||
|
||||
Reference in New Issue
Block a user