Skip to content

Commit

Permalink
Release v0.6.0 (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul authored Oct 4, 2022
1 parent ec8cbe6 commit baa118c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "superstruct"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
description = "Versioned data types with minimal boilerplate"
license = "Apache-2.0"
Expand Down
5 changes: 5 additions & 0 deletions book/src/codegen/enum.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,8 @@ are described [here](./ref-and-refmut.md).
* `to_ref` returning `{BaseName}Ref`.
* `to_mut` returning `{BaseName}RefMut`.

## `From` implementations

The top-level enum has `From` implementations for converting (owned) variant structs, i.e.

* `impl From<{VariantStruct}> for {BaseName}` for all variants
10 changes: 10 additions & 0 deletions book/src/codegen/ref-and-refmut.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,18 @@ reference to a `MyStruct` in order to construct: a reference to a single variant

## Trait Implementations

### `Copy`

Each `Ref` type is `Copy`, just like an ordinary `&T`.

### `From`

The `Ref` type has `From` implementations that allow converting from references to variants
or references to the top-level enum type, i.e.

- `impl From<&'a {VariantStruct}> for {BaseName}Ref<'a>` for all variants.
- `impl From<&'a {BaseName}> for {BaseName}Ref<'a>` (same as `to_ref()`).

## Example

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

0 comments on commit baa118c

Please sign in to comment.