File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " superstruct"
3
- version = " 0.5 .0"
3
+ version = " 0.6 .0"
4
4
edition = " 2021"
5
5
description = " Versioned data types with minimal boilerplate"
6
6
license = " Apache-2.0"
Original file line number Diff line number Diff line change @@ -63,3 +63,8 @@ are described [here](./ref-and-refmut.md).
63
63
* ` to_ref ` returning ` {BaseName}Ref ` .
64
64
* ` to_mut ` returning ` {BaseName}RefMut ` .
65
65
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
Original file line number Diff line number Diff line change @@ -39,8 +39,18 @@ reference to a `MyStruct` in order to construct: a reference to a single variant
39
39
40
40
## Trait Implementations
41
41
42
+ ### ` Copy `
43
+
42
44
Each ` Ref ` type is ` Copy ` , just like an ordinary ` &T ` .
43
45
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
+
44
54
## Example
45
55
46
56
Please see [ ` examples/nested.rs ` ] ( ../rustdoc/src/nested/nested.rs.html ) and its
You can’t perform that action at this time.
0 commit comments