package octez-proto-libs
- Overview
- No Docs
You can search for identifiers within the package.
in-package search v0.2.0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=dbc3b675aee59c2c574e5d0a771193a2ecfca31e7a5bc5aed66598080596ce1c
sha512=b97ed762b9d24744305c358af0d20f394376b64bfdd758dd4a81775326caf445caa57c4f6445da3dd6468ff492de18e4c14af6f374dfcbb7e4d64b7b720e5e2a
doc/octez-proto-libs.protocol-environment/Tezos_protocol_environment/V10/Make/Data_encoding/Binary/index.html
Module Data_encoding.Binary
val length : 'a encoding -> 'a -> intCompute the expected length of the binary representation of a value.
val fixed_length : 'a encoding -> int optionReturns the size of the binary representation that the given encoding might produce, only when this size does not depends of the value itself.
E.g., fixed_length (tup2 int64 (Fixed.string 2)) is Some _
E.g., fixed_length (result int64 (Fixed.string 2)) is None
E.g., fixed_length (list (tup2 int64 (Fixed.string 2))) is None
val maximum_length : 'a encoding -> int optionReturns the maximum size of the binary representation that the given encoding might produce, only when this maximum size does not depends of the value itself.
E.g., maximum_length (tup2 int64 (Fixed.string 2)) is Some _
E.g., maximum_length (result int64 (Fixed.string 2)) is Some _
E.g., maximum_length (list (tup2 int64 (Fixed.string 2))) is None
Note that the function assumes that recursive encodings (build using mu) are used for recursive data types. As a result, maximum_length will return None if given a recursive encoding.
If there are static guarantees about the maximum size of the representation for values of a given type, you can wrap your encoding in check_size. This will cause maximum_length to return Some _.
val of_bytes_opt : 'a encoding -> bytes -> 'a optionval of_string_opt : 'a encoding -> string -> 'a optionval to_bytes_opt : ?buffer_size:int -> 'a encoding -> 'a -> bytes optionval to_bytes_exn : ?buffer_size:int -> 'a encoding -> 'a -> bytesto_bytes_exn enc v is equivalent to to_bytes enc v, except
val to_string_opt : ?buffer_size:int -> 'a encoding -> 'a -> string optionval to_string_exn : ?buffer_size:int -> 'a encoding -> 'a -> string