Skip to main content

kcl_api/
front.rs

1use schemars::JsonSchema;
2use serde::Deserialize;
3use serde::Serialize;
4
5#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq, PartialOrd, Ord, Deserialize, Serialize, JsonSchema, ts_rs::TS)]
6#[ts(export, export_to = "FrontendApi.ts", rename = "ApiObjectId")]
7pub struct ObjectId(pub usize);
8
9impl ObjectId {
10    pub fn predecessor(self) -> Option<Self> {
11        self.0.checked_sub(1).map(ObjectId)
12    }
13}