pub(crate) fn get_or_register_style(&self, key: StyleKey) -> Result<Rc<StyleContent>> {
        let weak_mgr = self.downgrade();
        let mut reg = self.inner.registry.borrow_mut();

        if let Some(m) = reg.get(&key) {
            return Ok(m);
        }

        let id = match key.is_global {
            true => StyleId::new_global(&key.prefix),
            false => StyleId::new_scoped(&key.prefix),
        };

        // Non-global styles have ids prefixed in classes.
        let style_str = key.ast.to_style_str((!key.is_global).then_some(&id));

        // We parse the style str again in debug mode to ensure that interpolated values are
        // not corrupting the stylesheet.
        #[cfg(all(debug_assertions, feature = "debug_parser"))]
        style_str
            .parse::<crate::ast::Sheet>()
            .expect_display("debug: Stylist failed to parse the style with interpolated values");

        let content: Rc<_> = StyleContent {
            id,
            style_str,
            manager: weak_mgr,
            key: Rc::new(key),
        }
        .into();

        #[cfg(feature = "ssr")]
        {
            if let Some(ref mut style_data) = self.style_data() {
                // Automatically detach if has been used.
                style_data.as_vec_mut().push(StyleDataContent {
                    key: content.key().as_ref().clone(),
                    id: content.id().clone(),
                    style_str: content.get_style_str().to_string(),
                });

                // Register the created Style.
                reg.register(content.clone());

                return Ok(content);
            }
        }

        self.mount(&content)?;
        // Register the created Style.
        reg.register(content.clone());

        Ok(content)
    }
Returns the registry if it is availble, otherwise, creates the style and mounts it.
packages/stylist/src/manager/mod.rs