pub fn get_resource<T: Resource + Clone>(&mut self) -> Result<T, WiringError> {
        // Implementation details:
        // Internally the resources are stored as [`std::any::Any`], and this method does the downcasting
        // on behalf of the caller.
        #[allow(clippy::borrowed_box)]
        let downcast_clone = |resource: &Box<dyn StoredResource>| {
            resource
                .downcast_ref::<T>()
                .unwrap_or_else(|| {
                    panic!(
                        "Resource {} is not of type {}",
                        T::name(),
                        std::any::type_name::<T>()
                    )
                })
                .clone()
        };

        // Check whether the resource is already available.
        if let Some(resource) = self.service.resources.get(&ResourceId::of::<T>()) {
            tracing::info!(
                "Layer {} has requested resource {} of type {}",
                self.layer,
                T::name(),
                type_name::<T>()
            );
            return Ok(downcast_clone(resource));
        }

        tracing::info!(
            "Layer {} has requested resource {} of type {}, but it is not available",
            self.layer,
            T::name(),
            type_name::<T>()
        );

        // No such resource.
        // The requester is allowed to decide whether this is an error or not.
        Err(WiringError::ResourceLacking {
            name: T::name(),
            id: ResourceId::of::<T>(),
        })
    }
Attempts to retrieve the resource of the specified type.

## Panics

Panics if the resource with the specified [`ResourceId`] exists, but is not of the requested type.
core/lib/node_framework/src/service/context.rs