File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,6 +105,9 @@ pub trait SWCurveConfig: super::CurveConfig {
105105 res
106106 }
107107
108+ /// If uncompressed, serializes both x and y coordinates as well as a bit for whether it is
109+ /// infinity. If compressed, serializes x coordinate with two bits to encode whether y is
110+ /// positive, negative, or infinity.
108111 #[ inline]
109112 fn serialize_with_mode < W : Write > (
110113 item : & Affine < Self > ,
@@ -129,6 +132,7 @@ pub trait SWCurveConfig: super::CurveConfig {
129132 }
130133 }
131134
135+ /// If `validate` is `Yes`, calls `check()` to make sure the element is valid.
132136 fn deserialize_with_mode < R : Read > (
133137 mut reader : R ,
134138 compress : Compress ,
Original file line number Diff line number Diff line change @@ -85,6 +85,8 @@ pub trait TECurveConfig: super::CurveConfig {
8585 res
8686 }
8787
88+ /// If uncompressed, serializes both x and y coordinates.
89+ /// If compressed, serializes y coordinate with a bit to encode whether x is positive.
8890 #[ inline]
8991 fn serialize_with_mode < W : Write > (
9092 item : & Affine < Self > ,
@@ -101,6 +103,9 @@ pub trait TECurveConfig: super::CurveConfig {
101103 }
102104 }
103105
106+ /// If `validate` is `Yes`, calls `check()` to make sure the element is valid.
107+ ///
108+ /// Uses `Affine::get_xs_from_y_unchecked()` for the compressed version.
104109 fn deserialize_with_mode < R : Read > (
105110 mut reader : R ,
106111 compress : Compress ,
Original file line number Diff line number Diff line change @@ -23,12 +23,16 @@ pub use ark_serialize_derive::*;
2323
2424use digest:: { generic_array:: GenericArray , Digest , OutputSizeUser } ;
2525
26+ /// Whether to use a compressed version of the serialization algorithm. Specific behavior depends
27+ /// on implementation. If no compressed version exists (e.g. on `Fp`), mode is ignored.
2628#[ derive( Copy , Clone , PartialEq , Eq ) ]
2729pub enum Compress {
2830 Yes ,
2931 No ,
3032}
3133
34+ /// Whether to validate the element after deserializing it. Specific behavior depends on
35+ /// implementation. If no validation algorithm exists (e.g. on `Fp`), mode is ignored.
3236#[ derive( Copy , Clone , PartialEq , Eq ) ]
3337pub enum Validate {
3438 Yes ,
@@ -76,6 +80,7 @@ pub trait Valid: Sized + Sync {
7680/// }
7781/// ```
7882pub trait CanonicalSerialize {
83+ /// The general serialize method that takes in customization flags.
7984 fn serialize_with_mode < W : Write > (
8085 & self ,
8186 writer : W ,
@@ -118,6 +123,7 @@ pub trait CanonicalSerialize {
118123/// }
119124/// ```
120125pub trait CanonicalDeserialize : Valid {
126+ /// The general deserialize method that takes in customization flags.
121127 fn deserialize_with_mode < R : Read > (
122128 reader : R ,
123129 compress : Compress ,
You can’t perform that action at this time.
0 commit comments