@@ -57,7 +57,7 @@ impl<'a, const BOUND: usize> Encode for Bounded<&'a str, BOUND> {
5757 fn encode ( & self , mut w : impl std:: io:: Write ) -> Result < ( ) > {
5858 let len = self . 0 . encode_utf16 ( ) . count ( ) ;
5959
60- ensure ! ( len < BOUND , "length of string {len} exceeds bound {BOUND}" ) ;
60+ ensure ! ( len <= BOUND , "length of string {len} exceeds bound {BOUND}" ) ;
6161
6262 VarInt ( self . 0 . len ( ) as i32 ) . encode ( & mut w) ?;
6363 Ok ( w. write_all ( self . 0 . as_bytes ( ) ) ?)
@@ -74,7 +74,7 @@ impl Encode for str {
7474impl < ' a , const BOUND : usize > Encode for Bounded < Bytes < ' a > , BOUND > {
7575 fn encode ( & self , mut w : impl std:: io:: Write ) -> Result < ( ) > {
7676 let len = self . 0 . 0 . len ( ) ;
77- ensure ! ( len < BOUND , "length of bytes {len} exceeds bound {BOUND}" ) ;
77+ ensure ! ( len <= BOUND , "length of bytes {len} exceeds bound {BOUND}" ) ;
7878 VarInt ( len as i32 ) . encode ( & mut w) ?;
7979 self . 0 . encode ( & mut w)
8080 }
@@ -131,7 +131,7 @@ impl<'a, const BOUND: usize> Encode for Rest<&'a str, BOUND> {
131131 fn encode ( & self , mut w : impl std:: io:: Write ) -> Result < ( ) > {
132132 let len = self . 0 . encode_utf16 ( ) . count ( ) ;
133133
134- ensure ! ( len < BOUND , "length of string {len} exceeds bound {BOUND}" ) ;
134+ ensure ! ( len <= BOUND , "length of string {len} exceeds bound {BOUND}" ) ;
135135
136136 Ok ( w. write_all ( self . 0 . as_bytes ( ) ) ?)
137137 }
@@ -141,7 +141,7 @@ impl<'a, const BOUND: usize> Encode for Rest<Bytes<'a>, BOUND> {
141141 fn encode ( & self , mut w : impl std:: io:: Write ) -> Result < ( ) > {
142142 let len = self . 0 . 0 . len ( ) ;
143143
144- ensure ! ( len < BOUND , "length of bytes {len} exceeds bound {BOUND}" ) ;
144+ ensure ! ( len <= BOUND , "length of bytes {len} exceeds bound {BOUND}" ) ;
145145
146146 self . 0 . encode ( & mut w)
147147 }
0 commit comments