diff --git a/src/func.rs b/src/func.rs index cbbdead..c0dbf29 100644 --- a/src/func.rs +++ b/src/func.rs @@ -23,7 +23,7 @@ pub trait WeakFunctor { /// } /// /// impl Functor for VecClass { -/// fn fmap<'a, A: 'a, B: 'a>(f: impl 'a + FnOnce(A) -> B, fa: Self::F<'a, A>) -> Self::F<'a, B> +/// fn fmap<'a, A: 'a, B: 'a>(f: impl 'a + FnOnce(A) -> B, fa: Self::F<'a, A>) -> Self::F<'a, B> { /// fa.into_iter().map(f).collect() /// } /// } diff --git a/src/std.rs b/src/std.rs index fda58d6..57bab19 100644 --- a/src/std.rs +++ b/src/std.rs @@ -168,7 +168,7 @@ impl<'a, Ctx: 'a + Context, A: Mentionable<'a, Ctx>> AsRef<[u8]> for Point<'a, C } } -struct Addresses { +pub struct Addresses { current: usize, } diff --git a/src/std/atomic.rs b/src/std/atomic.rs index baec58e..ae21dc8 100644 --- a/src/std/atomic.rs +++ b/src/std/atomic.rs @@ -1,13 +1,22 @@ +//! This module allows to describe a primitive subset of [Mentionable] types, [Atomic]s, +//! simple static types, which are completely [Context]-independent. + use std::{error::Error, marker::PhantomData, rc::Rc}; use crate::core::*; +/// This trait combines functionality of [Mentionable] and [Factory], +/// while limiting [Mentionable::points] (and corresponding [Mentionable::topology]) to an empty sequence. pub trait Atomic: 'static + Sized + Clone + Serializable { + /// Equivalent of [Factory::ParseError]. type ParseError: Error; + /// Static equivalent of [Factory::deserialize]. fn deserialize(deserializer: &mut dyn Deserializer) -> Result; + /// Static equivalent of [Factory::unexpected_tail]. fn unexpected_tail(tail: &[u8]) -> Self::ParseError; } +/// Generic implementation of a factory for [Atomic]s. pub struct AtomicFactory(PhantomData); impl AtomicFactory { diff --git a/src/std/cast.rs b/src/std/cast.rs index 4220675..1d744db 100644 --- a/src/std/cast.rs +++ b/src/std/cast.rs @@ -60,11 +60,6 @@ impl<'a, Ctx: Context> TypelessMentionable<'a, Ctx> where Ctx::LookupError: From>, { - /// . - /// - /// # Errors - /// - /// This function will return an error if . pub fn cast>(&self, factory: A::Fctr) -> CastResult<'a, Ctx, A> { let mut vec = Vec::new(); self.serialize(&mut vec); diff --git a/src/std/nullable.rs b/src/std/nullable.rs index e0bc57c..cba7bee 100644 --- a/src/std/nullable.rs +++ b/src/std/nullable.rs @@ -1,12 +1,16 @@ +//! This module introduces [Option]-like concepts into RADN typesystem using [Nullable]. + use crate::core::*; use crate::std::*; -enum Nullable<'a, Ctx: 'a + Context, A: Mentionable<'a, Ctx>> { +/// Nullable reference type. Made for use as a linking element in data structures. +pub enum Nullable<'a, Ctx: 'a + Context, A: Mentionable<'a, Ctx>> { Null(A::Fctr), NotNull(Point<'a, Ctx, A>), } -struct NullableFactory<'a, Ctx: 'a + Context, A: Mentionable<'a, Ctx>> { +/// Nullable reference factory. +pub struct NullableFactory<'a, Ctx: 'a + Context, A: Mentionable<'a, Ctx>> { factory: A::Fctr, }