pub fn finish_with_suffix(mut self, suffix: &Name) -> Result<Box<Name>, Error> {
        if self.is_fully_qualified() {
            Err(Error::NullNonTerminal)
        } else {
            self.update_label_len();
            let label_offset_base = self.wire_repr.len() as u8;
            for label in suffix.labels() {
                self.wire_repr
                    .try_push(label.len() as u8)
                    .map_err(|_| Error::NameTooLong)?;
                self.wire_repr
                    .try_extend_from_slice(label.octets())
                    .map_err(|_| Error::NameTooLong)?;
            }
            for offset in suffix.label_offsets() {
                // The push will not fail, since we checked the validity
                // of the name as we went, and label_offsets has enough
                // room to store the label offsets for any valid name.
                self.label_offsets.push(*offset + label_offset_base);
            }
            unsafe {
                // SAFETY: we promise that we're passing a valid
                // on-the-wire representation and correct label offsets.
                Ok(new_boxed_name(
                    self.wire_repr.len(),
                    &self.label_offsets,
                    &[&self.wire_repr],
                ))
            }
        }
    }
/// Finishes the construction of the domain name by implicitly
/// finishing the current label and then appending the labels of the
/// domain name `suffix`. The `NameBuilder` itself is consumed.
/// Since only the last label of a domain name may be null, this
/// fails if the current label is null. It also fails if appending
/// `suffix` would make the name too long.
Finishes the construction of the domain name by implicitly
finishing the current label and then appending the labels of the
domain name `suffix`. The `NameBuilder` itself is consumed.
Since only the last label of a domain name may be null, this
fails if the current label is null. It also fails if appending
`suffix` would make the name too long.
Finishes the construction of the domain name by implicitly finishing the current label and then appending the labels of the domain name ` suffix ` . The ` NameBuilder ` itself is consumed . Since only the last label of a domain name may be null this fails if the current label is null . It also fails if appending ` suffix ` would make the name too long .
pub fn finish_with_suffix(mut self, suffix: &Name) -> Result<Box<Name>, Error> {
        if self.is_fully_qualified() {
            Err(Error::NullNonTerminal)
        } else {
            self.update_label_len();
            let label_offset_base = self.wire_repr.len() as u8;
            for label in suffix.labels() {
                self.wire_repr
                    .try_push(label.len() as u8)
                    .map_err(|_| Error::NameTooLong)?;
                self.wire_repr
                    .try_extend_from_slice(label.octets())
                    .map_err(|_| Error::NameTooLong)?;
            }
            for offset in suffix.label_offsets() {
                // The push will not fail, since we checked the validity
                // of the name as we went, and label_offsets has enough
                // room to store the label offsets for any valid name.
                self.label_offsets.push(*offset + label_offset_base);
            }
            unsafe {
                // SAFETY: we promise that we're passing a valid
                // on-the-wire representation and correct label offsets.
                Ok(new_boxed_name(
                    self.wire_repr.len(),
                    &self.label_offsets,
                    &[&self.wire_repr],
                ))
            }
        }
    }
pub fn finish_with_suffix ( mut self , suffix : & Name ) -> Result < Box < Name > , Error > { if self . is_fully_qualified ( ) { Err ( Error :: NullNonTerminal ) } else { self . update_label_len ( ) ; let label_offset_base = self . wire_repr . len ( ) as u8 ; for label in suffix . labels ( ) { self . wire_repr . try_push ( label . len ( ) as u8 ) . map_err ( | _ | Error :: NameTooLong ) ? ; self . wire_repr . try_extend_from_slice ( label . octets ( ) ) . map_err ( | _ | Error :: NameTooLong ) ? ; } for offset in suffix . label_offsets ( ) { // The push will not fail, since we checked the validity // of the name as we went, and label_offsets has enough // room to store the label offsets for any valid name. self . label_offsets . push ( * offset + label_offset_base ) ; } unsafe { // SAFETY: we promise that we're passing a valid // on-the-wire representation and correct label offsets. Ok ( new_boxed_name ( self . wire_repr . len ( ) , & self . label_offsets , & [ & self . wire_repr ] , ) ) } } }
Finishes the construction of the domain name by implicitly
finishing the current label and then appending the labels of the
domain name `suffix`.
Finishes the construction of the domain name by implicitly finishing the current label and then appending the labels of the domain name ` suffix ` .
mut self
suffix
&Name
mut self
suffix
&Name