pub fn validate(&self) -> Result<(), RequestError> {
        match self {
            Self::Copy { objects, .. } | Self::Take { objects, .. } => {
                // make sure object ID list is neither too long nor too short
                if objects.is_empty() {
                    return Err(RequestError::ObjectIdListTooShort);
                }
                if objects.len() > MAX_OBJECT_ID_LIST_LEN {
                    return Err(RequestError::ObjectIdListTooLong(objects.len()));
                }
            }
        }
        Ok(())
    }
// Checks whether this peer request is valid.
Checks whether this peer request is valid.
Checks whether this peer request is valid .
pub fn validate(&self) -> Result<(), RequestError> {
        match self {
            Self::Copy { objects, .. } | Self::Take { objects, .. } => {
                // make sure object ID list is neither too long nor too short
                if objects.is_empty() {
                    return Err(RequestError::ObjectIdListTooShort);
                }
                if objects.len() > MAX_OBJECT_ID_LIST_LEN {
                    return Err(RequestError::ObjectIdListTooLong(objects.len()));
                }
            }
        }
        Ok(())
    }
pub fn validate ( & self ) -> Result < ( ) , RequestError > { match self { Self :: Copy { objects , .. } | Self :: Take { objects , .. } => { // make sure object ID list is neither too long nor too short if objects . is_empty ( ) { return Err ( RequestError :: ObjectIdListTooShort ) ; } if objects . len ( ) > MAX_OBJECT_ID_LIST_LEN { return Err ( RequestError :: ObjectIdListTooLong ( objects . len ( ) ) ) ; } } } Ok ( ( ) ) }
Checks whether this peer request is valid.
Checks whether this peer request is valid .
&self
&self