@@ -374,6 +374,7 @@ impl From<SegwitHrpstringError> for DecodeError {
374
374
/// An error while constructing a [`SegwitHrpstring`] type.
375
375
#[ derive( Debug , Clone , PartialEq , Eq ) ]
376
376
#[ non_exhaustive]
377
+ #[ cfg( feature = "alloc" ) ]
377
378
pub enum EncodeError {
378
379
/// Invalid witness version (must be 0-16 inclusive).
379
380
WitnessVersion ( InvalidWitnessVersionError ) ,
@@ -385,6 +386,7 @@ pub enum EncodeError {
385
386
Fmt ( fmt:: Error ) ,
386
387
}
387
388
389
+ #[ cfg( feature = "alloc" ) ]
388
390
impl fmt:: Display for EncodeError {
389
391
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
390
392
use EncodeError :: * ;
@@ -399,6 +401,7 @@ impl fmt::Display for EncodeError {
399
401
}
400
402
401
403
#[ cfg( feature = "std" ) ]
404
+ #[ cfg( feature = "alloc" ) ]
402
405
impl std:: error:: Error for EncodeError {
403
406
fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
404
407
use EncodeError :: * ;
@@ -412,21 +415,25 @@ impl std::error::Error for EncodeError {
412
415
}
413
416
}
414
417
418
+ #[ cfg( feature = "alloc" ) ]
415
419
impl From < InvalidWitnessVersionError > for EncodeError {
416
420
#[ inline]
417
421
fn from ( e : InvalidWitnessVersionError ) -> Self { Self :: WitnessVersion ( e) }
418
422
}
419
423
424
+ #[ cfg( feature = "alloc" ) ]
420
425
impl From < WitnessLengthError > for EncodeError {
421
426
#[ inline]
422
427
fn from ( e : WitnessLengthError ) -> Self { Self :: WitnessLength ( e) }
423
428
}
424
429
430
+ #[ cfg( feature = "alloc" ) ]
425
431
impl From < SegwitCodeLengthError > for EncodeError {
426
432
#[ inline]
427
433
fn from ( e : SegwitCodeLengthError ) -> Self { Self :: TooLong ( e) }
428
434
}
429
435
436
+ #[ cfg( feature = "alloc" ) ]
430
437
impl From < fmt:: Error > for EncodeError {
431
438
#[ inline]
432
439
fn from ( e : fmt:: Error ) -> Self { Self :: Fmt ( e) }
0 commit comments