Skip to content

Commit

Permalink
fix macro docs and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
kkohbrok committed Nov 21, 2023
1 parent f2dc3db commit 67cbeb2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tls_codec/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tls_codec"
version = "0.4.0-pre.3"
version = "0.4.0-pre.4"
authors = ["RustCrypto Developers"]
license = "Apache-2.0 OR MIT"
documentation = "https://docs.rs/tls_codec/"
Expand All @@ -18,7 +18,7 @@ zeroize = { version = "1.7", default-features = false, features = [

# optional dependencies
arbitrary = { version = "1.3", features = ["derive"], optional = true }
tls_codec_derive = { version = "=0.4.0-pre.3", path = "./derive", optional = true }
tls_codec_derive = { version = "=0.4.0-pre.4", path = "./derive", optional = true }
serde = { version = "1.0.184", features = ["derive"], optional = true }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion tls_codec/derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tls_codec_derive"
version = "0.4.0-pre.3"
version = "0.4.0-pre.4"
authors = ["RustCrypto Developers"]
license = "Apache-2.0 OR MIT"
documentation = "https://docs.rs/tls_codec_derive/"
Expand Down
29 changes: 19 additions & 10 deletions tls_codec/derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1223,19 +1223,28 @@ fn partition_skipped(
)
}

/// The `conditionally_deserializable` attribute macro takes as input either
/// `Bytes` or `Reader` and does the following:
/// * Add a boolean const generic to the struct indicating if the variant of the
/// struct is deserializable or not.
/// * Depending on the input derive either the `TlsDeserialize` or
/// `TlsDeserializeBytes` trait for the deserializable variant
/// * Create type aliases for the deserializable and undeserializable variant of
/// the struct, where the alias is the name of the struct prefixed with
/// `Deserializable` or `Undeserializable` respectively.
/// The `conditionally_deserializable` attribute macro creates two versions of
/// the affected struct: One that implements the
/// [`Deserialize`](../tls_codec::Deserialize) and
/// [`DeserializeBytes`](../tls_codec::DeserializeBytes) traits and one that
/// does not. It does so by introducing a boolean const generic that indicates
/// if the struct can be deserialized or not.
///
/// This conditional deserialization can be used, for example, to implement a
/// simple state machine, where after deserialization, the user must first
/// complete an additional transition (e.g. verification) to the
/// undeserializable version of the struct, which might then implement functions
/// for further processing.
///
/// For ease of use, the macro creates type aliases for the deserializable and
/// undeserializable variant of the struct, where the alias is the name of the
/// struct prefixed with `Deserializable` or `Undeserializable` respectively.
///
/// Due to the way that the macro rewrites the struct, it must be placed before
/// any `#[derive(...)]` statements.
///
/// The `conditionally_deserializable` attribute macro is only available if the
/// `conditional_deserialization` feature is enabled.
///
#[cfg_attr(
feature = "conditional_deserialization",
doc = r##"
Expand Down

0 comments on commit 67cbeb2

Please sign in to comment.