Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move things around more #143

Merged
merged 1 commit into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/musli-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ alloc = []
verbose = ["musli-macros/verbose"]

[dependencies]
musli-macros = { version = "=0.0.119", path = "../musli-macros" }
musli-macros = { version = "=0.0.119", path = "../musli-macros", features = [] }

[dev-dependencies]
musli = { version = "=0.0.119", path = "../musli" }
6 changes: 1 addition & 5 deletions crates/musli-core/src/de/decode.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
use super::Decoder;

/// Please refer to the main [musli documentation](https://docs.rs/musli).
#[doc(inline)]
pub use musli_macros::Decode;

/// Trait governing how types are decoded.
///
/// This is typically implemented automatically using the [`Decode` derive].
Expand All @@ -19,7 +15,7 @@ pub use musli_macros::Decode;
/// struct MyType {
/// data: [u8; 128],
/// }
/// ````
/// ```
///
/// Implementing manually:
///
Expand Down
2 changes: 1 addition & 1 deletion crates/musli-core/src/de/decode_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use super::Decoder;
/// #[musli(bytes)]
/// data: [u8; 128],
/// }
/// ````
/// ```
///
/// Implementing manually:
///
Expand Down
2 changes: 1 addition & 1 deletion crates/musli-core/src/de/decode_packed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use super::Decoder;
/// #[musli(packed)]
/// data: (u32, u32),
/// }
/// ````
/// ```
///
/// Implementing manually:
///
Expand Down
2 changes: 1 addition & 1 deletion crates/musli-core/src/de/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub trait Decoder<'de>: Sized {
type DecodeVariant: VariantDecoder<'de, Cx = Self::Cx>;

/// This is a type argument used to hint to any future implementor that they
/// should be using the [`#[musli::decoder]`][crate::decoder] attribute
/// should be using the [`#[musli::decoder]`][musli::decoder] attribute
/// macro when implementing [`Decoder`].
#[doc(hidden)]
type __UseMusliDecoderAttributeMacro;
Expand Down
72 changes: 40 additions & 32 deletions crates/musli-core/src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,86 +6,94 @@
//! itself. This also comes with a derive allowing you to derive high
//! performance decoding associated with native Rust types.
//!
//! Note that using derives directly from `musli_core` requires you to use the
//! `#[musli(crate = musli_core)]` attribute.
//!
//! # Examples
//!
//! ```
//! use musli::Decode;
//! use musli_core::Decode;
//!
//! #[derive(Decode)]
//! #[musli(crate = musli_core)]
//! pub struct Person<'a> {
//! name: &'a str,
//! age: u32,
//! }
//! ```

mod skip;
#[doc(inline)]
pub use self::skip::Skip;

mod size_hint;
/// Derive which automatically implements the [`Decode` trait].
///
/// See the [`derives` module] for detailed documentation.
///
/// [`derives` module]: <https://docs.rs/musli/latest/musli/help/derives/index.html>
/// [`Decode` trait]: trait@Decode
///
/// # Examples
///
/// ```
/// use musli::Decode;
///
/// #[derive(Decode)]
/// struct MyType {
/// data: [u8; 128],
/// }
/// ```
#[doc(inline)]
pub use self::size_hint::SizeHint;
pub use musli_macros::Decode;

mod as_decoder;
#[doc(inline)]
pub use self::as_decoder::AsDecoder;

mod decode;
#[doc(inline)]
pub use self::decode::Decode;

mod decode_bytes;
pub use self::decode_bytes::DecodeBytes;

mod decode_packed;
pub use self::decode_packed::DecodePacked;

mod decode_trace;
#[doc(inline)]
pub use self::decode_trace::DecodeTrace;

mod decode_unsized;
#[doc(inline)]
pub use self::decode_unsized::DecodeUnsized;

mod decode_unsized_bytes;
#[doc(inline)]
pub use self::decode_unsized_bytes::DecodeUnsizedBytes;

mod decode_bytes;
#[doc(inline)]
pub use self::decode_bytes::DecodeBytes;

mod decode_packed;
#[doc(inline)]
pub use self::decode_packed::DecodePacked;

mod decoder;
#[doc(inline)]
pub use self::decoder::Decoder;

mod map_decoder;
#[doc(inline)]
pub use self::map_decoder::MapDecoder;

mod entries_decoder;
#[doc(inline)]
pub use self::entries_decoder::EntriesDecoder;

mod entry_decoder;
#[doc(inline)]
pub use self::entry_decoder::EntryDecoder;

mod map_decoder;
pub use self::map_decoder::MapDecoder;

mod number_visitor;
#[doc(inline)]
pub use self::number_visitor::NumberVisitor;

mod sequence_decoder;
#[doc(inline)]
pub use self::sequence_decoder::SequenceDecoder;

mod size_hint;
pub use self::size_hint::SizeHint;

mod skip;
pub use self::skip::Skip;

mod value_visitor;
#[doc(inline)]
pub use self::value_visitor::ValueVisitor;

mod variant_decoder;
#[doc(inline)]
pub use self::variant_decoder::VariantDecoder;

mod visitor;
#[doc(inline)]
pub use self::visitor::Visitor;

/// Decode to an owned value.
Expand Down
2 changes: 1 addition & 1 deletion crates/musli-core/src/de/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait Visitor<'de, C: ?Sized + Context>: Sized {
type Number: NumberVisitor<'de, C, Ok = Self::Ok>;

/// This is a type argument used to hint to any future implementor that they
/// should be using the [`#[musli::visitor]`][crate::visitor] attribute
/// should be using the [`#[musli::visitor]`][musli::visitor] attribute
/// macro when implementing [`Visitor`].
#[doc(hidden)]
type __UseMusliVisitorAttributeMacro;
Expand Down
4 changes: 1 addition & 3 deletions crates/musli-core/src/en/encode.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use crate::en::Encoder;

pub use musli_macros::Encode;

/// Trait governing how types are encoded.
///
/// This is typically implemented automatically using the [`Encode` derive].
Expand All @@ -17,7 +15,7 @@ pub use musli_macros::Encode;
/// struct MyType {
/// data: [u8; 128],
/// }
/// ````
/// ```
///
/// Implementing manually:
///
Expand Down
2 changes: 1 addition & 1 deletion crates/musli-core/src/en/encode_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::en::Encoder;
/// #[musli(bytes)]
/// data: [u8; 128],
/// }
/// ````
/// ```
///
/// Implementing manually:
///
Expand Down
2 changes: 1 addition & 1 deletion crates/musli-core/src/en/encode_packed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::en::Encoder;
/// #[musli(packed)]
/// data: (u32, u32),
/// }
/// ````
/// ```
///
/// Implementing manually:
///
Expand Down
2 changes: 1 addition & 1 deletion crates/musli-core/src/en/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub trait Encoder: Sized {
type EncodeMapVariant: MapEncoder<Cx = Self::Cx, Ok = Self::Ok>;

/// This is a type argument used to hint to any future implementor that they
/// should be using the [`#[musli::encoder]`][crate::encoder] attribute
/// should be using the [`#[musli::encoder]`][musli::encoder] attribute
/// macro when implementing [`Encoder`].
#[doc(hidden)]
type __UseMusliEncoderAttributeMacro;
Expand Down
58 changes: 37 additions & 21 deletions crates/musli-core/src/en/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,68 @@
//! also comes with a derive allowing you to derive high performance encoding
//! associated with native Rust types.
//!
//! Note that using derives directly from `musli_core` requires you to use the
//! `#[musli(crate = musli_core)]` attribute.
//!
//! # Examples
//!
//! ```
//! use musli::Encode;
//! use musli_core::Encode;
//!
//! #[derive(Encode)]
//! #[musli(crate = musli_core)]
//! pub struct Person<'a> {
//! name: &'a str,
//! age: u32,
//! }
//! ```

mod encode;
/// Derive which automatically implements the [`Encode` trait].
///
/// See the [`derives` module] for detailed documentation.
///
/// [`derives` module]: <https://docs.rs/musli/latest/musli/help/derives/index.html>
/// [`Encode` trait]: trait@Encode
///
/// # Examples
///
/// ```
/// use musli::Encode;
///
/// #[derive(Encode)]
/// struct MyType {
/// data: [u8; 128],
/// }
/// ```
#[doc(inline)]
pub use self::encode::Encode;
pub use musli_macros::Encode;

mod encode_trace;
#[doc(inline)]
pub use self::encode_trace::EncodeTrace;
mod encode;
pub use self::encode::Encode;

mod encode_bytes;
#[doc(inline)]
pub use self::encode_bytes::EncodeBytes;

mod encode_packed;
#[doc(inline)]
pub use self::encode_packed::EncodePacked;

mod encode_trace;
pub use self::encode_trace::EncodeTrace;

mod encoder;
#[doc(inline)]
pub use self::encoder::Encoder;

mod sequence_encoder;
#[doc(inline)]
pub use self::sequence_encoder::SequenceEncoder;

mod map_encoder;
#[doc(inline)]
pub use self::map_encoder::MapEncoder;
mod entries_encoder;
pub use self::entries_encoder::EntriesEncoder;

mod entry_encoder;
#[doc(inline)]
pub use self::entry_encoder::EntryEncoder;

mod entries_encoder;
#[doc(inline)]
pub use self::entries_encoder::EntriesEncoder;
mod map_encoder;
pub use self::map_encoder::MapEncoder;

mod sequence_encoder;
pub use self::sequence_encoder::SequenceEncoder;

mod variant_encoder;
#[doc(inline)]
pub use self::variant_encoder::VariantEncoder;
Loading