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

    HandlerId::equal

    fn HandlerId::equal(HandlerId, HandlerId) -> Bool

    HandlerId::hash

    fn HandlerId::hash(self : HandlerId) -> Int

    HandlerId::hash_combine

    fn HandlerId::hash_combine(HandlerId, Hasher) -> Unit

    HandlerId::not_equal

    fn HandlerId::not_equal(x : HandlerId, y : HandlerId) -> Bool

    HandlerId::output

    fn HandlerId::output(self : HandlerId, logger : &Logger) -> Unit

    HandlerId::to_string

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

    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::equal

    fn Method::equal(Method, Method) -> Bool

    Method::from_string

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

    Parse string to Method

    Method::hash

    fn Method::hash(self : Method) -> Int

    Method::hash_combine

    fn Method::hash_combine(Method, Hasher) -> Unit

    Method::not_equal

    fn Method::not_equal(x : Method, y : Method) -> Bool

    Method::output

    fn Method::output(self : Method, logger : &Logger) -> Unit

    Convert Method to string

    Method::to_string

    fn Method::to_string(self : Method) -> 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::output

    fn Params::output(self : Params, logger : &Logger) -> Unit

    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::to_string

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

    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