From 03a455613801a9f041912eadc917299279c8117a Mon Sep 17 00:00:00 2001 From: timofey Date: Fri, 13 Oct 2023 11:53:03 +0000 Subject: [PATCH] reorder imports --- book-monads | 2 +- book-radn | 2 +- src/flow/binary.rs | 10 ++++----- src/flow/binary/bound.rs | 1 - src/flow/traversible.rs | 4 ++-- src/func.rs | 8 +++---- src/lib.rs | 4 ++-- src/mode.rs | 12 +++++----- src/rcore.rs | 38 ++++++++++++++++---------------- src/rstd.rs | 12 +++++----- src/rstd/atomic.rs | 4 ++-- src/rstd/collections/tree.rs | 6 ++--- src/rstd/inlining.rs | 4 ++-- src/rstd/inlining/static_pair.rs | 2 -- src/rstd/tracing.rs | 12 +++++----- src/rstd/tracing/trace.rs | 4 ++-- src/rstd/typeless.rs | 1 - src/testing.rs | 6 ++--- 18 files changed, 64 insertions(+), 68 deletions(-) diff --git a/book-monads b/book-monads index f6e04d7..e93fbb3 160000 --- a/book-monads +++ b/book-monads @@ -1 +1 @@ -Subproject commit f6e04d75bab4a8dec916cc98a6dc18d26616888e +Subproject commit e93fbb3b9703ee4dc31745a771207e873be43dd0 diff --git a/book-radn b/book-radn index 1a04d7f..223c620 160000 --- a/book-radn +++ b/book-radn @@ -1 +1 @@ -Subproject commit 1a04d7f90a095be464c8b155856f2ef922582d4e +Subproject commit 223c6205ac5fb8b2c6a66cb0f34aa2adce4e295a diff --git a/src/flow/binary.rs b/src/flow/binary.rs index 31fe03a..9ea1659 100644 --- a/src/flow/binary.rs +++ b/src/flow/binary.rs @@ -1,8 +1,3 @@ -pub mod avl; -pub mod balancing; -pub mod bound; -pub mod bounds; - use std::fmt::Display; use crate::flow::comparator::*; @@ -10,6 +5,11 @@ use crate::func::{context::*, *}; use super::keyed::*; +pub mod avl; +pub mod balancing; +pub mod bound; +pub mod bounds; + pub type Split = ( ::Tree, ::Tree, diff --git a/src/flow/binary/bound.rs b/src/flow/binary/bound.rs index 77520ba..378f6ae 100644 --- a/src/flow/binary/bound.rs +++ b/src/flow/binary/bound.rs @@ -1,7 +1,6 @@ use super::avl::*; use super::bounds::*; use super::*; -use crate::func::context::*; #[derive(Clone)] pub struct Bound { diff --git a/src/flow/traversible.rs b/src/flow/traversible.rs index 6beb6d2..2325a28 100644 --- a/src/flow/traversible.rs +++ b/src/flow/traversible.rs @@ -1,12 +1,12 @@ //! Traversible binary trees. -pub mod algorithms; - use std::sync::Arc; use crate::flow::comparator::*; use crate::func::*; +pub mod algorithms; + pub type Split<'a, T, A, D> = ( Arc>, Arc>, diff --git a/src/func.rs b/src/func.rs index c5ba21e..0001636 100644 --- a/src/func.rs +++ b/src/func.rs @@ -7,6 +7,10 @@ //! * //! * +use self::applicative_select::ApplicativeSelect; +use self::controlflow::{ControlFlow, Iterative}; +pub use self::extensions::MonadExt; + pub mod applicative_select; pub mod class_prelude; pub mod context; @@ -23,10 +27,6 @@ pub mod test_suite; pub mod tests; pub mod weakfunctorany; -use self::applicative_select::ApplicativeSelect; -use self::controlflow::{ControlFlow, Iterative}; -pub use self::extensions::MonadExt; - /// Part of Haskell's `Functor f` responsible for having `f a`. /// /// diff --git a/src/lib.rs b/src/lib.rs index ecd7551..e11714d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,6 +9,8 @@ #![cfg_attr(doc, deny(rustdoc::invalid_rust_codeblocks))] #![cfg_attr(doc, deny(rustdoc::bare_urls))] +extern crate self as radn; + pub mod atomic; pub mod flow; pub mod func; @@ -18,5 +20,3 @@ pub mod rcore; pub mod rstd; #[cfg(test)] mod testing; - -extern crate self as radn; diff --git a/src/mode.rs b/src/mode.rs index 8194bae..b921abd 100644 --- a/src/mode.rs +++ b/src/mode.rs @@ -13,12 +13,6 @@ //! [`InliningAtomic`]: crate::atomic::InliningAtomic //! [`read_all`]: Deserializer::read_all -mod inlining; -mod regular; -mod serialization; -mod slice_deserializer; -mod stream; - use std::marker::PhantomData; pub use self::inlining::InliningMode; @@ -27,6 +21,12 @@ pub use self::serialization::{Deserializer, DeserializerExt, Serializable, Seria pub use self::slice_deserializer::SliceDeserializer; pub use self::stream::{FromRef, Stream, StreamExt, StreamResultExt}; +mod inlining; +mod regular; +mod serialization; +mod slice_deserializer; +mod stream; + /// See [`ModeResult`]. pub type ParseSuccess = ::ParseSuccess; diff --git a/src/rcore.rs b/src/rcore.rs index 1613603..df6a865 100644 --- a/src/rcore.rs +++ b/src/rcore.rs @@ -2,25 +2,6 @@ //! Brings [`Mentionable`]/[`Factory`]/[`Origin`] concepts from the original implementation in Python. //! Allows for more generic behaviour via [`Context`], as opposed to original async-only. -mod addresses; -mod context; -mod dectx; -mod demoted; -mod diagnostic; -mod hashing; -mod inctx; -mod inlining; -mod modes; -mod origin; -mod point; -mod points; -mod regular; -mod resolution; -mod resolver_origin; -mod singular; -mod to_hex; -mod topology; - use std::{error::Error, sync::Arc}; use crate::func::context::*; @@ -47,6 +28,25 @@ pub use self::singular::{SingularError, SingularResolution}; pub use self::to_hex::hex; pub use self::topology::{MentionableTop, TopoVec, Topology}; +mod addresses; +mod context; +mod dectx; +mod demoted; +mod diagnostic; +mod hashing; +mod inctx; +mod inlining; +mod modes; +mod origin; +mod point; +mod points; +mod regular; +mod resolution; +mod resolver_origin; +mod singular; +mod to_hex; +mod topology; + /// Helper alias for [`WeakFunctor::F`] of [`FunctorContext::T`]. /// /// [`WeakFunctor::F`]: crate::func::WeakFunctor::F diff --git a/src/rstd.rs b/src/rstd.rs index c883981..d1092d0 100644 --- a/src/rstd.rs +++ b/src/rstd.rs @@ -2,6 +2,12 @@ //! //! [`rcore`]: crate::rcore +use std::{error::Error, fmt::Display, sync::Arc}; + +use crate::func::*; +use crate::mode::*; +use crate::rcore::*; + pub mod atomic; pub mod atomic_object; pub mod collections; @@ -16,12 +22,6 @@ pub mod tracing; pub mod typeless; mod wrapped_origin; -use std::{error::Error, fmt::Display, sync::Arc}; - -use crate::func::*; -use crate::mode::*; -use crate::rcore::*; - impl Display for Address { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}@{}", hex(&self.point), self.index) diff --git a/src/rstd/atomic.rs b/src/rstd/atomic.rs index de3b926..a82c692 100644 --- a/src/rstd/atomic.rs +++ b/src/rstd/atomic.rs @@ -1,9 +1,9 @@ use std::error::Error; use std::fmt::Display; +use crate::{atomic::*, mode::*}; + pub mod array; pub mod au64; pub mod boolean; pub mod plain; - -use crate::{atomic::*, mode::*}; diff --git a/src/rstd/collections/tree.rs b/src/rstd/collections/tree.rs index 378829a..418086b 100644 --- a/src/rstd/collections/tree.rs +++ b/src/rstd/collections/tree.rs @@ -1,15 +1,15 @@ -use crate::atomic::*; -pub mod context; - use std::{error::Error, fmt::Display, marker::PhantomData}; use crate::{ + atomic::*, flow::binary::*, mode::*, rcore::*, rstd::{atomic::au64::*, nullable::*, point::*}, }; +pub mod context; + #[derive(Debug)] pub enum TreeParseError { HeightParse(IntParseError), diff --git a/src/rstd/inlining.rs b/src/rstd/inlining.rs index 190237a..f829756 100644 --- a/src/rstd/inlining.rs +++ b/src/rstd/inlining.rs @@ -1,13 +1,13 @@ //! Traits to better express parsing semantics. -pub mod static_pair; - use crate::atomic::*; use crate::mode::*; use crate::rcore::*; use super::{atomic_object::*, *}; +pub mod static_pair; + /// This factory always reads the same amount of bytes or returns error. pub trait FixedSizeFactory<'a, Ctx: Context<'a>>: InliningFactory<'a, Ctx> { /// For [`ConstSizeFactory`] this must return [`ConstSizeFactory::SIZE`]. diff --git a/src/rstd/inlining/static_pair.rs b/src/rstd/inlining/static_pair.rs index 0ed4f6b..be54ef1 100644 --- a/src/rstd/inlining/static_pair.rs +++ b/src/rstd/inlining/static_pair.rs @@ -3,8 +3,6 @@ use std::ops::Deref; -use crate::rstd::*; - use super::*; /// Trait to represent serialisation of object's data. diff --git a/src/rstd/tracing.rs b/src/rstd/tracing.rs index a349463..9fc3f87 100644 --- a/src/rstd/tracing.rs +++ b/src/rstd/tracing.rs @@ -1,11 +1,5 @@ //! Structures for tracing the execution flow of [Monad]s. -mod rendered; -mod rendered_display; -mod trace; -mod traceable; -mod traced; - use crate::rcore::*; use super::*; @@ -17,6 +11,12 @@ use self::trace::*; pub use self::traceable::Traceable; pub use self::traced::Traced; +mod rendered; +mod rendered_display; +mod trace; +mod traceable; +mod traced; + /// [`Diagnostic`] for [Traced] objects. /// /// [`Diagnostic::after`]/[`Diagnostic::before`] are represented in [`RenderedCommon::Event`]. diff --git a/src/rstd/tracing/trace.rs b/src/rstd/tracing/trace.rs index f89d07d..770b744 100644 --- a/src/rstd/tracing/trace.rs +++ b/src/rstd/tracing/trace.rs @@ -1,7 +1,7 @@ -pub mod render; - use std::{cmp::max, fmt::Display}; +pub mod render; + #[derive(Debug)] enum Trace { Pure, diff --git a/src/rstd/typeless.rs b/src/rstd/typeless.rs index bac5a7d..b524f91 100644 --- a/src/rstd/typeless.rs +++ b/src/rstd/typeless.rs @@ -3,7 +3,6 @@ //! [`rcore`]: crate::rcore use super::{tcast::*, wrapped_origin::*, *}; -use crate::mode::*; type TypelessSerialize<'a> = dyn 'a + Send + Sync + Fn(&mut dyn Serializer); diff --git a/src/testing.rs b/src/testing.rs index 4cd8aa0..f1f4a12 100644 --- a/src/testing.rs +++ b/src/testing.rs @@ -1,6 +1,3 @@ -pub mod counted; -pub mod traced; - use std::{error::Error, fmt::Display, sync::Arc}; use sha2::{Digest, Sha256}; @@ -9,6 +6,9 @@ use crate::func::{context::*, *}; use crate::rcore::*; use crate::rstd::{inject::*, typeless::*}; +pub mod counted; +pub mod traced; + pub struct NoDiagnostic; impl<'a, T: Monad<'a>> Diagnostic<'a, T> for NoDiagnostic {