yareio_sys/structure/
star.rs1use crate::structure::{Structure, StructureID};
4use crate::{prelude::*, CanFrom};
5use js_sys::Object;
6use std::convert::TryFrom;
7use wasm_bindgen::prelude::*;
8
9#[wasm_bindgen]
11extern "C" {
12 #[wasm_bindgen(extends = StructureID, typescript_type = "StarID")]
14 #[derive(Clone, Debug, PartialEq, Eq)]
15 pub type StarID;
16
17 #[wasm_bindgen(extends = Structure, typescript_type = "Star")]
21 #[derive(Clone, Debug, PartialEq, Eq)]
22 pub type Star;
23
24 #[wasm_bindgen(method, getter)]
25 pub fn id(this: &Star) -> StarID;
26
27 #[wasm_bindgen(method, getter)]
28 pub fn active_in(this: &Star) -> u32;
29
30 #[wasm_bindgen(method, getter)]
31 pub fn active_at(this: &Star) -> u32;
32}
33
34impl CanFrom<Structure> for Star {
35 #[inline]
36 fn can_from(value: &Structure) -> bool {
37 value.structure_type().to_str() == "star"
38 }
39}
40
41try_can_from!(impl TryFrom<Structure>, Error = Structure for Star);
42
43#[wasm_bindgen]
45extern "C" {
46 #[wasm_bindgen(extends = Object, typescript_type = "(typeof stars)")]
47 #[derive(Clone, Debug)]
48 pub type Stars;
49
50 #[wasm_bindgen(js_name = "stars")]
51 static _stars: Stars;
52}
53
54impl TryGetByID<EntityID, Star> for Stars {}
55impl TryGetByID<StructureID, Star> for Stars {}
56impl EnumerateByID<StarID, Star> for Stars {}
57impl GetByID<StarID, Star> for Stars {}
58
59#[inline(always)]
63pub fn stars() -> &'static Stars {
64 &_stars
65}
66
67#[wasm_bindgen]
69extern "C" {
70 #[wasm_bindgen(js_name = "star_zxq")]
71 static _star_zxq: Star;
72}
73
74#[inline(always)]
78pub fn star_zxq() -> &'static Star {
79 &_star_zxq
80}
81
82#[wasm_bindgen]
84extern "C" {
85 #[wasm_bindgen(js_name = "star_a1c")]
86 static _star_a1c: Star;
87}
88
89#[inline(always)]
93pub fn star_a1c() -> &'static Star {
94 &_star_a1c
95}
96
97#[wasm_bindgen]
99extern "C" {
100 #[wasm_bindgen(js_name = "star_p89")]
101 static _star_p89: Star;
102}
103
104#[inline(always)]
108pub fn star_p89() -> &'static Star {
109 &_star_p89
110}