diff --git a/src/lib.rs b/src/lib.rs index f596b463..805c7890 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,12 +1,13 @@ +// Recursion limit bump is to support Ritz, a JSX-like proc macro used for +// Rojo's web UI currently. #![recursion_limit = "128"] -// Macros #[macro_use] mod impl_from; pub mod commands; -// This module is only public for the purpose of testing right now, and won't be +// This module is only public for testing right now, and won't be // part of the first version of the Rojo API. #[doc(hidden)] pub mod project; @@ -21,3 +22,6 @@ mod session_id; mod snapshot; mod snapshot_middleware; mod web; + +pub use crate::session_id::SessionId; +pub use crate::web::interface as web_interface; diff --git a/src/session_id.rs b/src/session_id.rs index e025de1b..51596ba0 100644 --- a/src/session_id.rs +++ b/src/session_id.rs @@ -1,6 +1,10 @@ use serde::{Deserialize, Serialize}; use uuid::Uuid; +/// A randomly generated ID generated by Rojo during a serve session. +/// +/// If the session ID of the server changes between requests, that indicates +/// that a new server has started up and the session should be terminated. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct SessionId(Uuid); diff --git a/src/web/interface.rs b/src/web/interface.rs index 3f40b425..c1420275 100644 --- a/src/web/interface.rs +++ b/src/web/interface.rs @@ -1,5 +1,4 @@ -//! Defines all the structs needed to interact with the Rojo API from an -//! automation test perspective. +//! Defines all the structs needed to interact with the Rojo Serve API. use std::collections::HashSet; @@ -7,9 +6,13 @@ use serde::{Deserialize, Serialize}; use crate::session_id::SessionId; -pub const SERVER_VERSION: &str = env!("CARGO_PKG_VERSION"); +/// Server version to report over the API, not exposed outside this crate. +pub(crate) const SERVER_VERSION: &str = env!("CARGO_PKG_VERSION"); + +/// Current protocol version, which is required to match. pub const PROTOCOL_VERSION: u64 = 3; +/// Response body from /api/rojo #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ServerInfoResponse<'a> { @@ -20,6 +23,7 @@ pub struct ServerInfoResponse<'a> { // pub root_instance_id: RbxId, } +/// Response body from /api/read/{id} #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ReadResponse { @@ -28,6 +32,7 @@ pub struct ReadResponse { // pub instances: HashMap>, } +/// Response body from /api/subscribe/{cursor} #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SubscribeResponse { diff --git a/src/web/mod.rs b/src/web/mod.rs index df4c0127..05d55746 100644 --- a/src/web/mod.rs +++ b/src/web/mod.rs @@ -1,5 +1,5 @@ mod api; -mod interface; +pub mod interface; mod ui; mod util;