/// Ensures that the `service` can be registered. Returns true if the service needs to be
/// marked as primary, false otherwise.
Ensures that the `service` can be registered. Returns true if the service needs to be
marked as primary, false otherwise.
Ensures that the ` service ` can be registered . Returns true if the service needs to be marked as primary false otherwise .
fn validate_service(&self, service: &DeviceIdentificationService) -> Result<bool, zx::Status> {
        // Ensure that the server has space for the requested records.
        if !self.has_space(service.size()) {
            return Err(zx::Status::NO_RESOURCES);
        }
        // Ensure that only one service is requesting primary.
        if self.contains_primary() && service.contains_primary() {
            return Err(zx::Status::ALREADY_EXISTS);
        }
        // If this is the first advertisement, it may need to be marked as primary
        let needs_primary = self.advertisement_size() == 0;
        Ok(needs_primary)
    }
fn validate_service ( & self , service : & DeviceIdentificationService ) -> Result < bool , zx :: Status > { // Ensure that the server has space for the requested records. if ! self . has_space ( service . size ( ) ) { return Err ( zx :: Status :: NO_RESOURCES ) ; } // Ensure that only one service is requesting primary. if self . contains_primary ( ) && service . contains_primary ( ) { return Err ( zx :: Status :: ALREADY_EXISTS ) ; } // If this is the first advertisement, it may need to be marked as primary let needs_primary = self . advertisement_size ( ) == 0 ; Ok ( needs_primary ) }
Ensures that the `service` can be registered.
Ensures that the ` service ` can be registered .
&self
service
&DeviceIdentificationService