Files
accounts
async_stream
async_stream_impl
base64
blocks
bytes
buf
fmt
cadence_json
cfg_if
collections
crunchy
darling
darling_core
ast
codegen
error
options
usage
util
darling_macro
events
flow_sdk
entities
transaction
fnv
futures_channel
futures_core
futures_macro
futures_sink
futures_task
futures_timer
futures_util
async_await
future
future
try_future
lock
stream
futures_unordered
stream
all.rsany.rsbuffer_unordered.rsbuffered.rscatch_unwind.rschain.rschunks.rscollect.rsconcat.rscycle.rsenumerate.rsfilter.rsfilter_map.rsflatten.rsfold.rsfor_each.rsfor_each_concurrent.rsfuse.rsinto_future.rsmap.rsmod.rsnext.rspeek.rsready_chunks.rsscan.rsselect_next_some.rsskip.rsskip_while.rstake.rstake_until.rstake_while.rsthen.rsunzip.rszip.rs
try_stream
task
gen_keypair
get_account_info
getrandom
h2
codec
frame
hpack
proto
hashbrown
helloworld
hex
http
http_body
httparse
httpdate
hyper
body
client
common
proto
server
service
hyper_timeout
ident_case
indexmap
instant
itoa
lazy_static
libc
unix
lock_api
log
memchr
memchr
memmem
mio
event
net
sys
num_bigint
bigint
biguint
num_cpus
num_integer
num_traits
once_cell
otopr
otopr_derive
parking_lot
parking_lot_core
parse_transaction_arguments
percent_encoding
pin_project
pin_project_internal
pin_project_lite
pin_utils
ppv_lite86
proc_macro2
proc_macro_hack
proc_macro_nested
quote
rand
distributions
rngs
seq
rand_chacha
rand_core
rlp
rustc_hex
rustversion
ryu
scopeguard
scripts
secp256k1
secp256k1_sys
serde
de
private
ser
serde_derive
serde_json
serde_with
de
duplicate_key_impls
ser
utils
serde_with_macros
signal_hook_registry
slab
smallvec
socket2
strsim
syn
attr.rsawait.rsbigint.rsbuffer.rscustom_keyword.rscustom_punctuation.rsdata.rsderive.rsdiscouraged.rserror.rsexport.rsexpr.rsext.rsfile.rsgenerics.rsgroup.rsident.rsitem.rslib.rslifetime.rslit.rslookahead.rsmac.rsmacros.rsop.rsparse.rsparse_macro_input.rsparse_quote.rspat.rspath.rsprint.rspunctuated.rsreserved.rssealed.rsspan.rsspanned.rsstmt.rsthread.rstoken.rstt.rsty.rsverbatim.rswhitespace.rs
thiserror
thiserror_impl
tiny_keccak
tokio
fs
future
io
driver
util
async_buf_read_ext.rsasync_read_ext.rsasync_seek_ext.rsasync_write_ext.rsbuf_reader.rsbuf_stream.rsbuf_writer.rschain.rscopy.rscopy_bidirectional.rscopy_buf.rsempty.rsfill_buf.rsflush.rslines.rsmem.rsmod.rsread.rsread_buf.rsread_exact.rsread_int.rsread_line.rsread_to_end.rsread_to_string.rsread_until.rsrepeat.rsshutdown.rssink.rssplit.rstake.rsvec_with_initialized.rswrite.rswrite_all.rswrite_all_buf.rswrite_buf.rswrite_int.rswrite_vectored.rs
loom
std
macros
net
tcp
unix
park
process
runtime
blocking
stats
task
thread_pool
signal
sync
mpsc
rwlock
task
task
time
util
tokio_io_timeout
tokio_macros
tokio_stream
stream_ext
wrappers
tokio_util
codec
sync
tonic
client
codec
metadata
server
service
transport
tower
balance
buffer
builder
discover
limit
load
make
make_service
ready_cache
timeout
util
tower_layer
tower_service
tracing
tracing_attributes
tracing_core
tracing_futures
transactions
try_lock
unicode_xid
want
>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
use bytes::BufMut;
use crate::{
decoding::{Decodable, DecodingError},
encoding::Encodable,
traits::Signable,
wire_types::*,
Fixed32, Fixed64, VarInt,
};
macro_rules! signable {
($($id:ident($storage: ty)),*) => {$(
impl Signable for $id {
type Storage = $storage;
type From = Self;
fn zigzag_encode(this: Self) -> $storage {
const BITS_M1: u32 = <$id>::BITS - 1;
((this << 1) ^ (this >> BITS_M1)) as $storage
}
}
)*};
($($id:ident($storage: ty) = $signed:ident),*) => {$(
impl Signable for $id {
type Storage = $storage;
type From = $signed;
fn zigzag_encode(this: $signed) -> $storage {
const BITS_M1: u32 = <$signed>::BITS - 1;
((this << 1) ^ (this >> BITS_M1)) as $storage
}
}
)*};
}
signable!(i32(u32), i64(u64));
signable!(Fixed32(u32) = i32, Fixed64(u32) = i64);
crate::seal! {
for u64,
for u32,
for i64,
for i32,
for u16,
for u8,
for usize,
for Fixed32,
for Fixed64,
}
impl Encodable for str {
type Wire = LengthDelimitedWire;
fn encoded_size<V: VarInt>(&self, field_number: V) -> usize {
field_number.size() + self.len().size() + self.len()
}
fn encode(&self, s: &mut crate::encoding::ProtobufSerializer<impl BufMut>) {
s.write_str(self)
}
}
impl Encodable for bool {
type Wire = VarIntWire;
fn encoded_size<V: VarInt>(&self, field_number: V) -> usize {
field_number.size() + 1
}
fn encode(&self, s: &mut crate::encoding::ProtobufSerializer<impl BufMut>) {
s.write_u8(*self as u8);
}
}
impl Decodable<'_> for bool {
type Wire = VarIntWire;
fn decode<B: bytes::Buf>(
deserializer: &mut crate::decoding::Deserializer<'_, B>,
) -> crate::decoding::Result<Self> {
match deserializer.get_u8() {
0b0000_0001 => Ok(true),
0b0000_0000 => Ok(false),
_ => Err(DecodingError::VarIntOverflow),
}
}
}