Example invocation:
cargo run my-protocol.pdl --output-format rust > my-protocol.rs
This section contains the generated rust bindings for language constructs that are stabilized.
Private prevents users from creating arbitrary scalar values in situations where the value needs to be validated. Users can freely deref the value, but only the backend may create it.
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct Private<T>(T);
impl<T> std::ops::Deref for Private<T> { .. }
enum TestEnum : 8 { A = 1, B = 2, } |
#[repr(u64)]
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)]
enum TestEnum {
A = 1,
B = 2,
}
impl TryFrom<u8> for TestEnum { .. }
impl From<TestEnum> for u8 { .. }
impl From<TestEnum> for u16 { .. }
impl From<TestEnum> for u32 { .. }
impl From<TestEnum> for u64 { .. }
impl From<TestEnum> for i8 { .. }
impl From<TestEnum> for i16 { .. }
impl From<TestEnum> for i32 { .. }
impl From<TestEnum> for i64 { .. } |
enum TestEnum : 8 { A = 1, B = 2..10 { C = 3, }, } |
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)]
enum TestEnum {
A,
C,
B(Private<u8>),
}
impl TryFrom<u8> for TestEnum { .. }
impl From<TestEnum> for u8 { .. }
impl From<TestEnum> for u16 { .. }
impl From<TestEnum> for u32 { .. }
impl From<TestEnum> for u64 { .. }
impl From<TestEnum> for i8 { .. }
impl From<TestEnum> for i16 { .. }
impl From<TestEnum> for i32 { .. }
impl From<TestEnum> for i64 { .. } |