11#![ doc = include_str ! ( "../README.md" ) ]
2+ #![ deny( missing_docs) ]
23
34use canon_json:: CanonicalFormatter ;
45use cap_std:: fs:: { Dir , DirBuilderExt } ;
@@ -48,19 +49,35 @@ pub enum Error {
4849 CryptographicError ( Box < str > ) ,
4950 #[ error( "Expected digest {expected} but found {found}" ) ]
5051 /// Returned when a digest does not match
51- DigestMismatch { expected : Box < str > , found : Box < str > } ,
52+ DigestMismatch {
53+ /// Expected digest value
54+ expected : Box < str > ,
55+ /// Found digest value
56+ found : Box < str > ,
57+ } ,
5258 #[ error( "Expected size {expected} but found {found}" ) ]
5359 /// Returned when a descriptor digest does not match what was expected
54- SizeMismatch { expected : u64 , found : u64 } ,
60+ SizeMismatch {
61+ /// Expected size value
62+ expected : u64 ,
63+ /// Found size value
64+ found : u64 ,
65+ } ,
5566 #[ error( "Expected digest algorithm sha256 but found {found}" ) ]
5667 /// Returned when a digest algorithm is not supported
57- UnsupportedDigestAlgorithm { found : Box < str > } ,
68+ UnsupportedDigestAlgorithm {
69+ /// The unsupported digest algorithm that was found
70+ found : Box < str > ,
71+ } ,
5872 #[ error( "Cannot find the Image Index (index.json)" ) ]
5973 /// Returned when the OCI Image Index (index.json) is missing
6074 MissingImageIndex ,
6175 #[ error( "Unexpected media type {media_type}" ) ]
6276 /// Returned when there's an unexpected media type
63- UnexpectedMediaType { media_type : MediaType } ,
77+ UnexpectedMediaType {
78+ /// The unexpected media type that was encountered
79+ media_type : MediaType ,
80+ } ,
6481 #[ error( "error" ) ]
6582 /// An unknown other error
6683 Other ( Box < str > ) ,
@@ -731,6 +748,7 @@ impl std::io::Write for BlobWriter<'_> {
731748
732749/// A writer that can be finalized to return an inner writer.
733750pub trait WriteComplete < W > : Write {
751+ /// Complete the write operation and return the inner writer
734752 fn complete ( self ) -> std:: io:: Result < W > ;
735753}
736754
@@ -767,6 +785,7 @@ impl<'a, W> LayerWriter<'a, W>
767785where
768786 W : WriteComplete < BlobWriter < ' a > > ,
769787{
788+ /// Create a new LayerWriter with the given inner writer and media type
770789 pub fn new ( inner : W , media_type : oci_image:: MediaType ) -> Self {
771790 Self {
772791 inner : Sha256Writer :: new ( inner) ,
@@ -775,6 +794,7 @@ where
775794 }
776795 }
777796
797+ /// Complete the layer writing and return the layer descriptor
778798 pub fn complete ( self ) -> Result < Layer > {
779799 let ( uncompressed_sha256, enc) = self . inner . finish ( ) ;
780800 let blob = enc. complete ( ) ?. complete ( ) ?;
0 commit comments