Skip to content

Commit

Permalink
Fix broken readme links
Browse files Browse the repository at this point in the history
  • Loading branch information
smessmer committed Feb 9, 2024
1 parent 6c5aa10 commit e3133d6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
4.0.1 (unreleased)
------
- Fix broken links in README

4.0.0
------
This release adds supports for types that can throw errors when reading or writing.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Layouts are defined using the [binary_layout!](https://docs.rs/binary-layout/lat
- [u8](https://doc.rust-lang.org/stable/core/primitive.u8.html), [u16](https://doc.rust-lang.org/stable/core/primitive.u16.html), [u32](https://doc.rust-lang.org/stable/core/primitive.u32.html), [u64](https://doc.rust-lang.org/stable/core/primitive.u64.html), [u128](https://doc.rust-lang.org/stable/core/primitive.u128.html)
- [i8](https://doc.rust-lang.org/stable/core/primitive.i8.html), [i16](https://doc.rust-lang.org/stable/core/primitive.i16.html), [i32](https://doc.rust-lang.org/stable/core/primitive.i32.html), [i64](https://doc.rust-lang.org/stable/core/primitive.i64.html), [i128](https://doc.rust-lang.org/stable/core/primitive.i128.html)

For these fields, the [Field](https://docs.rs/binary-layout/latest/binary_layout/trait.Field.html) API offers [FieldReadExt::read], [FieldWriteExt::write], [FieldCopyAccess::try_read](https://docs.rs/binary-layout/latest/binary_layout/trait.FieldCopyAccess.html#tymethod.try_read), [FieldCopyAccess::try_write](https://docs.rs/binary-layout/latest/binary_layout/trait.FieldCopyAccess.html#tymethod.try_write) and the [FieldView](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html) API offers [FieldView::read](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html#method.read) and [FieldView::write](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html#method.write).
For these fields, the [Field](https://docs.rs/binary-layout/latest/binary_layout/trait.Field.html) API offers [FieldReadExt::read](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldReadExt.html#method.read), [FieldWriteExt::write](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldWriteExt.html#method.write), [FieldCopyAccess::try_read](https://docs.rs/binary-layout/latest/binary_layout/trait.FieldCopyAccess.html#tymethod.try_read), [FieldCopyAccess::try_write](https://docs.rs/binary-layout/latest/binary_layout/trait.FieldCopyAccess.html#tymethod.try_write) and the [FieldView](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html) API offers [FieldView::read](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html#method.read) and [FieldView::write](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html#method.write).

#### Primitive float types
- [f32](https://doc.rust-lang.org/core/primitive.f32.html), [f64](https://doc.rust-lang.org/core/primitive.f64.html)
Expand All @@ -109,13 +109,13 @@ For these fields, the [Field](https://docs.rs/binary-layout/latest/binary_layout
- [NonZeroU8](https://doc.rust-lang.org/core/num/struct.NonZeroU8.html), [NonZeroU16](https://doc.rust-lang.org/core/num/struct.NonZeroU16.html), [NonZeroU32](https://doc.rust-lang.org/core/num/struct.NonZeroU32.html), [NonZeroU64](https://doc.rust-lang.org/core/num/struct.NonZeroU64.html), [NonZeroU128](https://doc.rust-lang.org/core/num/struct.NonZeroU128.html)
- [NonZeroI8](https://doc.rust-lang.org/core/num/struct.NonZeroI8.html), [NonZeroI16](https://doc.rust-lang.org/core/num/struct.NonZeroI16.html), [NonZeroI32](https://doc.rust-lang.org/core/num/struct.NonZeroI32.html), [NonZeroI64](https://doc.rust-lang.org/core/num/struct.NonZeroI64.html), [NonZeroI128](https://doc.rust-lang.org/core/num/struct.NonZeroI128.html)

Reading a zero values will throw an error. Because of this, [FieldReadExt::read] and [FieldView::read](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html#method.read) are not available for those types and you need to use [FieldCopyAccess::try_read](https://docs.rs/binary-layout/latest/binary_layout/trait.FieldCopyAccess.html#tymethod.try_read) and [FieldView::try_read](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html#method.try_read).
Reading a zero values will throw an error. Because of this, [FieldReadExt::read](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldReadExt.html#method.read) and [FieldView::read](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html#method.read) are not available for those types and you need to use [FieldCopyAccess::try_read](https://docs.rs/binary-layout/latest/binary_layout/trait.FieldCopyAccess.html#tymethod.try_read) and [FieldView::try_read](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html#method.try_read).

#### bool, char
[bool](https://doc.rust-lang.org/stable/core/primitive.bool.html) and [char](https://doc.rust-lang.org/stable/core/primitive.char.html) are supported using the `bool as u8` and `char as u32` data type notation.

Note that not only `0u8` and `1u8` are valid boolean values and not all [u32](https://doc.rust-lang.org/stable/core/primitive.u32.html) values are valid unicode code points.
Reading invalid values will throw an error. Because of this, [FieldReadExt::read] and [FieldView::read](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html#method.read) are not available for those types and you need to use [FieldCopyAccess::try_read](https://docs.rs/binary-layout/latest/binary_layout/trait.FieldCopyAccess.html#tymethod.try_read) and [FieldView::try_read](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html#method.try_read).
Reading invalid values will throw an error. Because of this, [FieldReadExt::read](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldReadExt.html#method.read) and [FieldView::read](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html#method.read) are not available for those types and you need to use [FieldCopyAccess::try_read](https://docs.rs/binary-layout/latest/binary_layout/trait.FieldCopyAccess.html#tymethod.try_read) and [FieldView::try_read](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldView.html#method.try_read).

#### Primitive Zero-Sized Types (ZSTs)

Expand Down
6 changes: 6 additions & 0 deletions gen_readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ sed -i 's|\[FieldCopyAccess::\([a-zA-Z_]\+\)\]\([^(]\)|[FieldCopyAccess::\1](htt
# Replace [FieldSliceAccess::my_method_name] with [FieldSliceAccess::my_method_name](https://docs.rs/binary-layout/latest/binary_layout/trait.FieldSliceAccess.html#tymethod.my_method_name)
sed -i 's|\[FieldSliceAccess::\([a-zA-Z_]\+\)\]\([^(]\)|[FieldSliceAccess::\1](https://docs.rs/binary-layout/latest/binary_layout/trait.FieldSliceAccess.html#tymethod.\1)\2|g' README.md

# Replace [FieldReadExt::my_method_name] with [FieldReadExt::my_method_name](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldReadExt.html#method.my_method_name)
sed -i 's|\[FieldReadExt::\([a-zA-Z_]\+\)\]\([^(]\)|[FieldReadExt::\1](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldReadExt.html#method.\1)\2|g' README.md

# Replace [FieldWriteExt::my_method_name] with [FieldWriteExt::my_method_name](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldWriteExt.html#method.my_method_name)
sed -i 's|\[FieldWriteExt::\([a-zA-Z_]\+\)\]\([^(]\)|[FieldWriteExt::\1](https://docs.rs/binary-layout/latest/binary_layout/struct.FieldWriteExt.html#method.\1)\2|g' README.md

# Replace [...](crate::example::icmp_packet) with [...](https://docs.rs/binary-layout/latest/binary_layout/example/icmp_packet/index.html)
sed -i 's|\[\([a-zA-Z_]\+\)\](crate::example::icmp_packet)|[\1](https://docs.rs/binary-layout/latest/binary_layout/example/icmp_packet/index.html)|g' README.md

Expand Down

0 comments on commit e3133d6

Please sign in to comment.