Skip to content

Commit baa118c

Browse files
Release v0.6.0 (#24)
1 parent ec8cbe6 commit baa118c

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "superstruct"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
edition = "2021"
55
description = "Versioned data types with minimal boilerplate"
66
license = "Apache-2.0"

book/src/codegen/enum.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,8 @@ are described [here](./ref-and-refmut.md).
6363
* `to_ref` returning `{BaseName}Ref`.
6464
* `to_mut` returning `{BaseName}RefMut`.
6565

66+
## `From` implementations
67+
68+
The top-level enum has `From` implementations for converting (owned) variant structs, i.e.
69+
70+
* `impl From<{VariantStruct}> for {BaseName}` for all variants

book/src/codegen/ref-and-refmut.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,18 @@ reference to a `MyStruct` in order to construct: a reference to a single variant
3939

4040
## Trait Implementations
4141

42+
### `Copy`
43+
4244
Each `Ref` type is `Copy`, just like an ordinary `&T`.
4345

46+
### `From`
47+
48+
The `Ref` type has `From` implementations that allow converting from references to variants
49+
or references to the top-level enum type, i.e.
50+
51+
- `impl From<&'a {VariantStruct}> for {BaseName}Ref<'a>` for all variants.
52+
- `impl From<&'a {BaseName}> for {BaseName}Ref<'a>` (same as `to_ref()`).
53+
4454
## Example
4555

4656
Please see [`examples/nested.rs`](../rustdoc/src/nested/nested.rs.html) and its

0 commit comments

Comments
 (0)