Validate that this value has a supported canonical representation.
(self)
| 85 | |
| 86 | /// Validate that this value has a supported canonical representation. |
| 87 | pub fn validate(self) -> Result<(), AttrValueError> { |
| 88 | match self { |
| 89 | Self::Mode(mode) if mode > 0o777 => Err(AttrValueError::InvalidMode(mode)), |
| 90 | Self::Mode(_) | Self::Kind(_) => Ok(()), |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | /// Encode the canonical value as `(length, bytes)`. |
| 95 | pub fn canonical_bytes(self) -> Result<(u8, [u8; 2]), AttrValueError> { |
no outgoing calls
no test coverage detected