FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    service

    function · ferroui-base · v0.5.0

    fn service<T: 'static>(service_type: std::any::TypeId, handle: impl FnOnce() -> T) -> Option<std::rc::Rc<dyn Any>>
    

    Boxes a service handle for IServiceProvider::get_service if it is the requested one. Meant for implementations:

    fn get_service(&self, service_type: TypeId) -> Option<Rc<dyn Any>> {
        service(service_type, || self.name_scope.clone())
            .or_else(|| service(service_type, || self.root_object_provider()))
    }
    

    View source

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.