Git Product home page Git Product logo

Comments (2)

kjuulh avatar kjuulh commented on June 15, 2024

Yep, I've got a fork with the update, so I will post it and we'll see when the maintainer can get it merged.

Also for the state, you can simply add it to a struct

    #[derive(Clone)]
    pub struct SharedApp(Arc<App>);

    impl Deref for SharedApp {
        type Target = Arc<App>;

        fn deref(&self) -> &Self::Target {
            &self.0
        }
    }

    pub struct App {
        pub is: IntrospectionState,
          // Add your own state here
    }
    
        impl App {
        pub fn to_shared(self) -> SharedApp {
            SharedApp(Arc::new(self))
        }
    }

    impl FromRef<SharedApp> for IntrospectionState {
        fn from_ref(input: &SharedApp) -> Self {
            input.is.clone()
        }
    }

// ... Se example 

   let is = IntrospectionStateBuilder::new("https://zitadel-libraries-l8boqa.zitadel.cloud")
        .with_basic_auth(
            // ... skipped for brevity
        )
        .build()
        .await
        .unwrap();
        
    let state = App {
        is
        // ... Add your other state
    }.to_shared()

    let app = Router::new()
        .route("/unauthed", get(unauthed))
        .route("/authed", get(authed))
        .with_state(state);

Something along those lines.

Btw this is the recommended pattern from upstream as well

from zitadel-rust.

github-actions avatar github-actions commented on June 15, 2024

🎉 This issue has been resolved in version 3.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from zitadel-rust.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.