partway towards commands
I got very confused and started mucking about with "spawn" when in fact all I needed was the "inline" extension type in orcx that allows the interpreter to expose custom constants.
This commit is contained in:
@@ -6,6 +6,7 @@ edition = "2024"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
chrono = "0.4.43"
|
||||
futures = { version = "0.3.31", features = ["std"], default-features = false }
|
||||
itertools = "0.14.0"
|
||||
never = "0.1.0"
|
||||
|
||||
@@ -7,6 +7,7 @@ use std::ops::{Range, RangeInclusive};
|
||||
use std::pin::Pin;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use futures::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||
use never::Never;
|
||||
@@ -352,3 +353,26 @@ impl Encode for char {
|
||||
(*self as u32).encode(write).await
|
||||
}
|
||||
}
|
||||
|
||||
impl Decode for Duration {
|
||||
async fn decode<R: AsyncRead + ?Sized>(mut read: Pin<&mut R>) -> io::Result<Self> {
|
||||
Ok(Self::new(u64::decode(read.as_mut()).await?, u32::decode(read).await?))
|
||||
}
|
||||
}
|
||||
impl Encode for Duration {
|
||||
async fn encode<W: AsyncWrite + ?Sized>(&self, mut write: Pin<&mut W>) -> io::Result<()> {
|
||||
self.as_secs().encode(write.as_mut()).await?;
|
||||
self.subsec_nanos().encode(write).await
|
||||
}
|
||||
}
|
||||
impl Decode for chrono::TimeDelta {
|
||||
async fn decode<R: AsyncRead + ?Sized>(mut read: Pin<&mut R>) -> io::Result<Self> {
|
||||
Ok(Self::new(i64::decode(read.as_mut()).await?, u32::decode(read).await?).unwrap())
|
||||
}
|
||||
}
|
||||
impl Encode for chrono::TimeDelta {
|
||||
async fn encode<W: AsyncWrite + ?Sized>(&self, mut write: Pin<&mut W>) -> io::Result<()> {
|
||||
self.num_seconds().encode(write.as_mut()).await?;
|
||||
self.subsec_nanos().encode(write).await
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ impl TLBool for TLTrue {}
|
||||
pub struct TLFalse;
|
||||
impl TLBool for TLFalse {}
|
||||
|
||||
/// A type that implements [Hierarchy]. Used to select implementations of traits
|
||||
/// on the hierarchy
|
||||
/// A type that implements [Extends] or a root. Used to select implementations
|
||||
/// of traits on the hierarchy
|
||||
pub trait InHierarchy: Clone {
|
||||
/// Indicates that this hierarchy element is a leaf. Leaves can never have
|
||||
/// children
|
||||
|
||||
Reference in New Issue
Block a user