mizchi/mars/router does not have a README file

    Router

    pub(open) trait Router {
    fn name(Self) -> String
    fn add(Self, Method, String) -> HandlerId
    fn match_(Self, Method, String) -> MatchResult[HandlerId]
    }

    Router trait for HTTP routing The router stores handlers by ID, and the actual handler lookup is done externally

    HandlerId

    pub(all) struct HandlerId(Int) derive(Eq, Hash,
    Debug
    )

    Handler ID for storing handlers
    impl Show for HandlerId

    MatchResult

    pub(all) struct MatchResult[H] {
    handlers : Array[(H, Params)]
    }

    Result of route matching

    MatchResult::empty

    fn[H] MatchResult::empty() -> MatchResult[H]

    Create an empty match result

    MatchResult::is_empty

    fn[H] MatchResult::is_empty(self : MatchResult[H]) -> Bool

    Check if match result has any handlers

    Method

    pub(all) enum Method {
    Get
    Post
    Put
    Delete
    Patch
    Head
    Options
    Connect
    Trace
    Query
    All
    } derive(Eq, Hash)

    HTTP method type
    impl Show for Method

    Method::from_string

    fn Method::from_string(s : String) -> Method?

    Parse string to Method

    Method::to_string

    fn Method::to_string(self : Method) -> String

    Convert Method to string

    Params

    pub(all) struct Params {
    // private fields
    }

    URL path parameters extracted from route matching
    impl Show for Params

    Params::clone

    fn Params::clone(self : Params) -> Params

    Clone params

    Params::get

    fn Params::get(self : Params, key : String) -> String?

    Get a parameter value by key

    Params::is_empty

    fn Params::is_empty(self : Params) -> Bool

    Check if params is empty

    Params::new

    fn Params::new() -> Params

    Create a new empty Params

    Params::set

    fn Params::set(self : Params, key : String, value : String) -> Unit

    Set a parameter value

    Params::to_map

    fn Params::to_map(self : Params) -> Map[String, String]

    Get the underlying map

    Params::with_param

    fn Params::with_param(self : Params, key : String, value : String) -> Params

    Create a new Params with an additional key-value pair More efficient than clone + set when adding a single param

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io