@@ -31,7 +31,7 @@ use crate::{
3131use std:: ffi:: c_void;
3232use std:: marker:: PhantomData ;
3333
34- /** A binary attachment to a Document. */
34+ /// A binary attachment to a Document
3535pub struct Blob {
3636 pub ( crate ) cbl_ref : * const CBLBlob ,
3737}
@@ -46,7 +46,7 @@ impl CblRef for Blob {
4646impl Blob {
4747 //////// CREATION
4848
49- /** Creates a new blob, given its contents as a byte array. */
49+ /// Creates a new blob, given its contents as a byte array.
5050 pub fn new_from_data ( data : & [ u8 ] , content_type : & str ) -> Self {
5151 unsafe {
5252 let blob = CBLBlob_CreateWithData (
@@ -57,8 +57,8 @@ impl Blob {
5757 }
5858 }
5959
60- /** Creates a new blob from data that has has been written to a [`Writer`].
61- You should then add the blob to a document as a property, using [`Slot::put_blob`]. */
60+ /// Creates a new blob from data that has has been written to a [`Writer`].
61+ /// You should then add the blob to a document as a property, using [`Slot::put_blob`].
6262 pub fn new_from_stream ( mut stream : BlobWriter , content_type : & str ) -> Self {
6363 unsafe {
6464 let blob = CBLBlob_CreateWithStream ( from_str ( content_type) . get_ref ( ) , stream. get_ref ( ) ) ;
@@ -67,7 +67,7 @@ impl Blob {
6767 }
6868 }
6969
70- // called by FleeceReference::as_blob()
70+ /// called by FleeceReference::as_blob()
7171 pub ( crate ) fn from_value < V : FleeceReference > ( value : & V ) -> Option < Self > {
7272 unsafe {
7373 let blob = FLDict_GetBlob ( FLValue_AsDict ( value. _fleece_ref ( ) ) ) ;
@@ -81,30 +81,30 @@ impl Blob {
8181
8282 //////// ACCESSORS
8383
84- /** The length of the content data in bytes. */
84+ /// The length of the content data in bytes
8585 pub fn length ( & self ) -> u64 {
8686 unsafe { CBLBlob_Length ( self . get_ref ( ) ) }
8787 }
8888
89- /** The unique digest of the blob: A base64-encoded SHA-1 digest of its data. */
89+ /// The unique digest of the blob: A base64-encoded SHA-1 digest of its data
9090 pub fn digest ( & self ) -> & str {
9191 unsafe { CBLBlob_Digest ( self . get_ref ( ) ) . as_str ( ) . unwrap ( ) }
9292 }
9393
94- /** The MIME type assigned to the blob, if any. */
94+ /// The MIME type assigned to the blob, if any
9595 pub fn content_type ( & self ) -> Option < & str > {
9696 unsafe { CBLBlob_ContentType ( self . get_ref ( ) ) . as_str ( ) }
9797 }
9898
99- /** The blob's metadata properties as a dictionary. */
99+ /// The blob's metadata properties as a dictionary
100100 pub fn properties ( & self ) -> Dict {
101101 unsafe { Dict :: new ( CBLBlob_Properties ( self . get_ref ( ) ) ) }
102102 }
103103
104104 //////// READING:
105105
106- /** Reads the blob's contents into memory and returns them as a byte array.
107- This can potentially allocate a lot of memory! */
106+ /// Reads the blob's contents into memory and returns them as a byte array.
107+ /// This can potentially allocate a lot of memory!
108108 pub fn load_content ( & self ) -> Result < Vec < u8 > > {
109109 unsafe {
110110 let mut err = CBLError :: default ( ) ;
@@ -113,7 +113,7 @@ impl Blob {
113113 }
114114 }
115115
116- /** Opens a stream for reading a blob's content from disk. */
116+ /// Opens a stream for reading a blob's content from disk.
117117 pub fn open_content ( & self ) -> Result < BlobReader > {
118118 check_ptr (
119119 |err| unsafe { CBLBlob_OpenContentStream ( self . get_ref ( ) , err) } ,
@@ -146,15 +146,15 @@ impl Clone for Blob {
146146//////// BLOB ADDITIONS FOR ARRAY / DICT:
147147
148148impl Slot < ' _ > {
149- /** Stores a Blob reference in an Array or Dict. This is how you add a Blob to a Document. */
149+ /// Stores a Blob reference in an Array or Dict. This is how you add a Blob to a Document.
150150 pub fn put_blob ( self , blob : & mut Blob ) {
151151 unsafe { FLSlot_SetBlob ( self . get_ref ( ) , blob. get_ref ( ) as * mut CBLBlob ) }
152152 }
153153}
154154
155155//////// BLOB READER
156156
157- /** A stream for reading Blob conents. */
157+ /// A stream for reading Blob conents
158158pub struct BlobReader < ' r > {
159159 pub blob : & ' r Blob ,
160160 stream_ref : * mut CBLBlobReadStream ,
@@ -192,9 +192,8 @@ impl Drop for BlobReader<'_> {
192192
193193//////// BLOB WRITER
194194
195- /** A stream for writing data that will become a Blob's contents.
196- After you're done writing the data, call [`Blob::new_from_stream`],
197- then add the Blob to a document property via [`Slot::put_blob`]. */
195+ /// A stream for writing data that will become a Blob's contents.
196+ /// After you're done writing the data, call [`Blob::new_from_stream`], then add the Blob to a document property via [`Slot::put_blob`].
198197pub struct BlobWriter < ' d > {
199198 stream_ref : * mut CBLBlobWriteStream ,
200199 db : PhantomData < & ' d mut Database > ,
0 commit comments