File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,15 @@ impl Inflate {
8080 u64:: from ( self . 0 . total_out )
8181 }
8282
83+ /// The error message if the previous operation failed.
84+ pub fn error_message ( & self ) -> Option < & ' static str > {
85+ if self . 0 . msg . is_null ( ) {
86+ None
87+ } else {
88+ unsafe { core:: ffi:: CStr :: from_ptr ( self . 0 . msg ) . to_str ( ) } . ok ( )
89+ }
90+ }
91+
8392 /// Create a new instance. Note that it allocates in various ways and thus should be re-used.
8493 ///
8594 /// The `window_bits` must be in the range `8..=15`, with `15` being most common.
@@ -203,6 +212,15 @@ impl Deflate {
203212 u64:: from ( self . 0 . total_out )
204213 }
205214
215+ /// The error message if the previous operation failed.
216+ pub fn error_message ( & self ) -> Option < & ' static str > {
217+ if self . 0 . msg . is_null ( ) {
218+ None
219+ } else {
220+ unsafe { core:: ffi:: CStr :: from_ptr ( self . 0 . msg ) . to_str ( ) } . ok ( )
221+ }
222+ }
223+
206224 /// Create a new instance - this allocates so should be done with care.
207225 ///
208226 /// The `window_bits` must be in the range `8..=15`, with `15` being most common.
You can’t perform that action at this time.
0 commit comments