Skip to content

Commit cc384f9

Browse files
committed
ssh-encoding: fix encoded_len for [u8; N]
Followup to #342, which only updated the `encode` method. This aligns the `encoded_len` method with that change.
1 parent abc1bf4 commit cc384f9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ssh-encoding/src/encode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl Encode for [u8] {
155155
}
156156
}
157157

158-
/// Encodes `[u8; N]` into `byte[n]` as described in [RFC4251 § 5]:
158+
/// Encodes `[u8; N]` into `byte[N]` as described in [RFC4251 § 5]:
159159
///
160160
/// > A byte represents an arbitrary 8-bit value (octet). Fixed length
161161
/// > data is sometimes represented as an array of bytes, written
@@ -167,7 +167,7 @@ impl Encode for [u8] {
167167
/// [RFC4251 § 5]: https://datatracker.ietf.org/doc/html/rfc4251#section-5
168168
impl<const N: usize> Encode for [u8; N] {
169169
fn encoded_len(&self) -> Result<usize, Error> {
170-
self.as_slice().encoded_len()
170+
Ok(N)
171171
}
172172

173173
fn encode(&self, writer: &mut impl Writer) -> Result<(), Error> {

0 commit comments

Comments
 (0)