@@ -7,61 +7,61 @@ import(
77)
88
99// Values
10- fn __ws_emit(@native.CStr, @native.CStr, @native.CStr) -> Unit
10+ pub fn __ws_emit(@native.CStr, @native.CStr, @native.CStr) -> Unit
1111
12- fn async_run(async () -> Unit noraise) -> Unit
12+ pub fn async_run(async () -> Unit noraise) -> Unit
1313
14- fn cookie_to_string(Array[CookieItem]) -> String
14+ pub fn cookie_to_string(Array[CookieItem]) -> String
1515
16- async fn execute_middlewares(Array[(String, async (MocketEvent, async () -> &Responder noraise) -> &Responder noraise)], MocketEvent, async (MocketEvent) -> &Responder noraise) -> &Responder noraise
16+ pub async fn execute_middlewares(Array[(String, async (MocketEvent, async () -> &Responder noraise) -> &Responder noraise)], MocketEvent, async (MocketEvent) -> &Responder noraise) -> &Responder noraise
1717
18- fn form_encode(Map[String, String]) -> String
18+ pub fn form_encode(Map[String, String]) -> String
1919
20- async fn handle_not_found(MocketEvent) -> &Responder noraise
20+ pub async fn handle_not_found(MocketEvent) -> &Responder noraise
2121
22- fn html(&Show) -> &Responder
22+ pub fn html(&Show) -> &Responder
2323
24- fn new(base_path? : String) -> Mocket
24+ pub fn new(base_path? : String) -> Mocket
2525
26- fn parse_cookie(StringView) -> Map[String, CookieItem]
26+ pub fn parse_cookie(StringView) -> Map[String, CookieItem]
2727
28- fn parse_form_data(BytesView) -> Map[String, String]
28+ pub fn parse_form_data(BytesView) -> Map[String, String]
2929
30- fn parse_multipart(BytesView, String) -> Map[String, MultipartFormValue]
30+ pub fn parse_multipart(BytesView, String) -> Map[String, MultipartFormValue]
3131
32- fn register_ws_handler(Mocket, Int) -> Unit
32+ pub fn register_ws_handler(Mocket, Int) -> Unit
3333
34- fn serve_ffi(Mocket, port~ : Int) -> Unit
34+ pub fn serve_ffi(Mocket, port~ : Int) -> Unit
3535
36- async fn[T, E : Error] suspend(((T) -> Unit, (E) -> Unit) -> Unit) -> T raise E
36+ pub async fn[T, E : Error] suspend(((T) -> Unit, (E) -> Unit) -> Unit) -> T raise E
3737
38- fn text(&Show) -> &Responder
38+ pub fn text(&Show) -> &Responder
3939
40- fn url_decode(BytesView) -> String
40+ pub fn url_decode(BytesView) -> String
4141
42- fn url_encode(String) -> String
42+ pub fn url_encode(String) -> String
4343
44- fn ws_pong(String) -> Unit
44+ pub fn ws_pong(String) -> Unit
4545
46- fn ws_publish(String, String) -> Unit
46+ pub fn ws_publish(String, String) -> Unit
4747
48- fn ws_send(String, String) -> Unit
48+ pub fn ws_send(String, String) -> Unit
4949
50- fn ws_send_bytes(String, Bytes) -> Unit
50+ pub fn ws_send_bytes(String, Bytes) -> Unit
5151
52- fn ws_subscribe(String, String) -> Unit
52+ pub fn ws_subscribe(String, String) -> Unit
5353
54- fn ws_unsubscribe(String, String) -> Unit
54+ pub fn ws_unsubscribe(String, String) -> Unit
5555
5656// Errors
5757pub suberror ExecError
58- impl Show for ExecError
58+ pub impl Show for ExecError
5959
6060pub suberror IOError
61- impl Show for IOError
61+ pub impl Show for IOError
6262
6363pub suberror NetworkError
64- impl Show for NetworkError
64+ pub impl Show for NetworkError
6565
6666// Types and methods
6767pub(all) struct CookieItem {
@@ -74,40 +74,40 @@ pub(all) struct CookieItem {
7474 http_only : Bool?
7575 same_site : SameSiteOption?
7676}
77- impl Eq for CookieItem
78- impl Show for CookieItem
77+ pub impl Eq for CookieItem
78+ pub impl Show for CookieItem
7979
8080type Html
81- impl Responder for Html
81+ pub impl Responder for Html
8282
8383pub(all) struct HttpRequest {
8484 http_method : String
8585 url : String
8686 headers : Map[StringView, StringView]
8787 mut raw_body : Bytes
8888}
89- fn[T : BodyReader] HttpRequest::body(Self) -> T raise
90- fn HttpRequest::get_cookie(Self, String) -> CookieItem?
91- impl Responder for HttpRequest
89+ pub fn[T : BodyReader] HttpRequest::body(Self) -> T raise
90+ pub fn HttpRequest::get_cookie(Self, String) -> CookieItem?
91+ pub impl Responder for HttpRequest
9292
9393#external
9494pub type HttpRequestInternal
95- fn HttpRequestInternal::on_complete(Self, FuncRef[() -> Unit]) -> Unit
96- fn HttpRequestInternal::on_headers(Self, FuncRef[(@native.CStr) -> Unit]) -> Unit
95+ pub fn HttpRequestInternal::on_complete(Self, FuncRef[() -> Unit]) -> Unit
96+ pub fn HttpRequestInternal::on_headers(Self, FuncRef[(@native.CStr) -> Unit]) -> Unit
9797
9898pub(all) struct HttpResponse {
9999 mut status_code : StatusCode
100100 headers : Map[StringView, StringView]
101101 cookies : Map[String, CookieItem]
102102 mut raw_body : Bytes
103103}
104- fn HttpResponse::body(Self, &Responder) -> Self
105- fn HttpResponse::delete_cookie(Self, String) -> Unit
106- fn HttpResponse::json(Self, &ToJson) -> Self
107- fn HttpResponse::new(StatusCode, headers? : Map[StringView, StringView], cookies? : Map[String, CookieItem], raw_body? : Bytes) -> Self
108- fn HttpResponse::set_cookie(Self, String, String, max_age? : Int, path? : String, domain? : String, secure? : Bool, http_only? : Bool, same_site? : SameSiteOption) -> Unit
109- fn HttpResponse::to_responder(Self) -> &Responder
110- impl Responder for HttpResponse
104+ pub fn HttpResponse::body(Self, &Responder) -> Self
105+ pub fn HttpResponse::delete_cookie(Self, String) -> Unit
106+ pub fn HttpResponse::json(Self, &ToJson) -> Self
107+ pub fn HttpResponse::new(StatusCode, headers? : Map[StringView, StringView], cookies? : Map[String, CookieItem], raw_body? : Bytes) -> Self
108+ pub fn HttpResponse::set_cookie(Self, String, String, max_age? : Int, path? : String, domain? : String, secure? : Bool, http_only? : Bool, same_site? : SameSiteOption) -> Unit
109+ pub fn HttpResponse::to_responder(Self) -> &Responder
110+ pub impl Responder for HttpResponse
111111
112112#external
113113pub type HttpResponseInternal
@@ -128,22 +128,22 @@ pub(all) struct Mocket {
128128 ws_channels : Map[String, Map[String, Unit]]
129129 ws_client_port : Map[String, Int]
130130}
131- fn Mocket::all(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
132- fn Mocket::connect(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
133- fn Mocket::delete(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
134- fn Mocket::get(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
135- fn Mocket::group(Self, String, (Self) -> Unit) -> Unit
136- fn Mocket::head(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
137- fn Mocket::on(Self, String, String, async (MocketEvent) -> &Responder noraise) -> Unit
138- fn Mocket::options(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
139- fn Mocket::patch(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
140- fn Mocket::post(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
141- fn Mocket::put(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
142- fn Mocket::serve(Self, port~ : Int) -> Unit
143- fn Mocket::static_assets(Self, String, &ServeStaticProvider) -> Unit
144- fn Mocket::trace(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
145- fn Mocket::use_middleware(Self, async (MocketEvent, async () -> &Responder noraise) -> &Responder noraise, base_path? : String) -> Unit
146- fn Mocket::ws(Self, String, (WebSocketEvent) -> Unit) -> Unit
131+ pub fn Mocket::all(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
132+ pub fn Mocket::connect(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
133+ pub fn Mocket::delete(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
134+ pub fn Mocket::get(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
135+ pub fn Mocket::group(Self, String, (Self) -> Unit) -> Unit
136+ pub fn Mocket::head(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
137+ pub fn Mocket::on(Self, String, String, async (MocketEvent) -> &Responder noraise) -> Unit
138+ pub fn Mocket::options(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
139+ pub fn Mocket::patch(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
140+ pub fn Mocket::post(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
141+ pub fn Mocket::put(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
142+ pub fn Mocket::serve(Self, port~ : Int) -> Unit
143+ pub fn Mocket::static_assets(Self, String, &ServeStaticProvider) -> Unit
144+ pub fn Mocket::trace(Self, String, async (MocketEvent) -> &Responder noraise) -> Unit
145+ pub fn Mocket::use_middleware(Self, async (MocketEvent, async () -> &Responder noraise) -> &Responder noraise, base_path? : String) -> Unit
146+ pub fn Mocket::ws(Self, String, (WebSocketEvent) -> Unit) -> Unit
147147
148148pub(all) struct MocketEvent {
149149 req : HttpRequest
@@ -162,9 +162,9 @@ pub(all) enum SameSiteOption {
162162 Strict
163163 SameSiteNone
164164}
165- impl Eq for SameSiteOption
166- impl Show for SameSiteOption
167- impl ToJson for SameSiteOption
165+ pub impl Eq for SameSiteOption
166+ pub impl Show for SameSiteOption
167+ pub impl ToJson for SameSiteOption
168168
169169pub(all) struct StaticAssetMeta {
170170 asset_type : String?
@@ -174,7 +174,7 @@ pub(all) struct StaticAssetMeta {
174174 size : Int64?
175175 encoding : String?
176176}
177- fn StaticAssetMeta::new(asset_type? : String, etag? : String, mtime? : Int64, path? : String, size? : Int64, encoding? : String) -> Self
177+ pub fn StaticAssetMeta::new(asset_type? : String, etag? : String, mtime? : Int64, path? : String, size? : Int64, encoding? : String) -> Self
178178
179179pub(all) enum StatusCode {
180180 Continue
@@ -241,10 +241,10 @@ pub(all) enum StatusCode {
241241 NetworkAuthenticationRequired
242242 Custom(Int)
243243}
244- fn StatusCode::from_int(Int) -> Self
245- fn StatusCode::to_int(Self) -> Int
246- impl Show for StatusCode
247- impl ToJson for StatusCode
244+ pub fn StatusCode::from_int(Int) -> Self
245+ pub fn StatusCode::to_int(Self) -> Int
246+ pub impl Show for StatusCode
247+ pub impl ToJson for StatusCode
248248
249249pub enum WebSocketAggregatedMessage {
250250 Text(String)
@@ -262,13 +262,13 @@ pub(all) struct WebSocketPeer {
262262 connection_id : String
263263 mut subscribed_channels : Array[String]
264264}
265- fn WebSocketPeer::binary(Self, Bytes) -> Unit
266- fn WebSocketPeer::pong(Self) -> Unit
267- fn WebSocketPeer::publish(String, String) -> Unit
268- fn WebSocketPeer::subscribe(Self, String) -> Unit
269- fn WebSocketPeer::text(Self, String) -> Unit
270- fn WebSocketPeer::to_string(Self) -> String
271- fn WebSocketPeer::unsubscribe(Self, String) -> Unit
265+ pub fn WebSocketPeer::binary(Self, Bytes) -> Unit
266+ pub fn WebSocketPeer::pong(Self) -> Unit
267+ pub fn WebSocketPeer::publish(String, String) -> Unit
268+ pub fn WebSocketPeer::subscribe(Self, String) -> Unit
269+ pub fn WebSocketPeer::text(Self, String) -> Unit
270+ pub fn WebSocketPeer::to_string(Self) -> String
271+ pub fn WebSocketPeer::unsubscribe(Self, String) -> Unit
272272
273273// Type aliases
274274pub type HttpHandler = async (MocketEvent) -> &Responder noraise
@@ -281,21 +281,21 @@ pub type WebSocketHandler = (WebSocketEvent) -> Unit
281281pub(open) trait BodyReader {
282282 from_request(HttpRequest) -> Self raise
283283}
284- impl BodyReader for String
285- impl BodyReader for FixedArray[Byte]
286- impl BodyReader for Bytes
287- impl BodyReader for Array[Byte]
288- impl BodyReader for Json
284+ pub impl BodyReader for String
285+ pub impl BodyReader for FixedArray[Byte]
286+ pub impl BodyReader for Bytes
287+ pub impl BodyReader for Array[Byte]
288+ pub impl BodyReader for Json
289289
290290pub(open) trait Responder {
291291 options(Self, HttpResponse) -> Unit
292292 output(Self, @buffer.Buffer) -> Unit
293293}
294- impl Responder for String
295- impl Responder for Bytes
296- impl Responder for Json
297- impl Responder for &ToJson
298- impl Responder for StringView
294+ pub impl Responder for String
295+ pub impl Responder for Bytes
296+ pub impl Responder for Json
297+ pub impl Responder for &ToJson
298+ pub impl Responder for StringView
299299
300300pub(open) trait ServeStaticProvider {
301301 get_meta(Self, String) -> StaticAssetMeta?
0 commit comments