pub struct CoresState {
pub real_level: i64,
pub fantasy_level: i64,
pub laws: Vec<OwnedLaw>,
pub bridges: Vec<LawBridge>,
pub pet_facet_law_choices: PetFacetLawChoices,
}Expand description
Durable cores/laws/bridges state of one character. The all-zero default is the pre-feature character: no cores, no laws, no bridges, multiplier ×1.0.
Fields§
§real_level: i64§fantasy_level: i64§laws: Vec<OwnedLaw>§bridges: Vec<LawBridge>§pet_facet_law_choices: PetFacetLawChoicesOut-of-combat Law pre-selections for the three Pet Facets that act on
“one chosen Law” (LeadReading, WildReading, DreamReader). Kept with
the laws because that is what they select; the all-None default is a
character who has never opened the picker.
Implementations§
Source§impl CoresState
impl CoresState
pub fn level_of(&self, side: WorldSide) -> i64
pub fn set_level(&mut self, side: WorldSide, level: i64)
pub fn law(&self, template_id: LawTemplateId) -> Option<&OwnedLaw>
pub fn law_mut(&mut self, template_id: LawTemplateId) -> Option<&mut OwnedLaw>
Sourcepub fn bridge_count_for_law(&self, law_id: LawTemplateId) -> usize
pub fn bridge_count_for_law(&self, law_id: LawTemplateId) -> usize
How many bridges law_id currently participates in. v0.2 caps this at
one (mechanics::cores::MAX_BRIDGES_PER_LAW): a law has exactly one
partner, and the interesting choice is who it is.
Sourcepub fn bridge_of(&self, law_id: LawTemplateId) -> Option<&LawBridge>
pub fn bridge_of(&self, law_id: LawTemplateId) -> Option<&LawBridge>
The bridge law_id belongs to, if any.
Sourcepub fn slotted_laws(&self) -> impl Iterator<Item = &OwnedLaw>
pub fn slotted_laws(&self) -> impl Iterator<Item = &OwnedLaw>
Laws currently sitting in a slot, in slot order.
Trait Implementations§
Source§impl Clone for CoresState
impl Clone for CoresState
Source§fn clone(&self) -> CoresState
fn clone(&self) -> CoresState
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CoresState
impl Debug for CoresState
Source§impl Default for CoresState
impl Default for CoresState
Source§fn default() -> CoresState
fn default() -> CoresState
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for CoresState
impl<'de> Deserialize<'de> for CoresState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<CoresState> for JsValuewhere
CoresState: Serialize,
impl From<CoresState> for JsValuewhere
CoresState: Serialize,
Source§fn from(value: CoresState) -> Self
fn from(value: CoresState) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for CoresStatewhere
Self: DeserializeOwned,
impl FromWasmAbi for CoresStatewhere
Self: DeserializeOwned,
Source§impl IntoWasmAbi for CoresStatewhere
CoresState: Serialize,
impl IntoWasmAbi for CoresStatewhere
CoresState: Serialize,
Source§impl JsonSchema for CoresState
impl JsonSchema for CoresState
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreSource§impl OptionFromWasmAbi for CoresStatewhere
Self: DeserializeOwned,
impl OptionFromWasmAbi for CoresStatewhere
Self: DeserializeOwned,
Source§impl OptionIntoWasmAbi for CoresStatewhere
CoresState: Serialize,
impl OptionIntoWasmAbi for CoresStatewhere
CoresState: Serialize,
Source§impl PartialEq for CoresState
impl PartialEq for CoresState
Source§impl RefFromWasmAbi for CoresStatewhere
Self: DeserializeOwned,
impl RefFromWasmAbi for CoresStatewhere
Self: DeserializeOwned,
Source§type Abi = <JsType as RefFromWasmAbi>::Abi
type Abi = <JsType as RefFromWasmAbi>::Abi
The Wasm ABI type references to
Self are recovered from.Source§type Anchor = SelfOwner<CoresState>
type Anchor = SelfOwner<CoresState>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl Serialize for CoresState
impl Serialize for CoresState
Source§impl Tsify for CoresState
impl Tsify for CoresState
const DECL: &'static str = "/**\n * Durable cores/laws/bridges state of one character. The all-zero default is\n * the pre-feature character: no cores, no laws, no bridges, multiplier \u{d7}1.0.\n */\nexport interface CoresState {\n real_level: number;\n fantasy_level: number;\n laws: OwnedLaw[];\n bridges: LawBridge[];\n /**\n * Out-of-combat Law pre-selections for the three Pet Facets that act on\n * \\\"one chosen Law\\\" (`LeadReading`, `WildReading`, `DreamReader`). Kept with\n * the laws because that is what they select; the all-`None` default is a\n * character who has never opened the picker.\n */\n pet_facet_law_choices: PetFacetLawChoices;\n}"
const SERIALIZATION_CONFIG: SerializationConfig
type JsType = JsType
fn into_js(&self) -> Result<Self::JsType, Error>where
Self: Serialize,
fn from_js<T>(js: T) -> Result<Self, Error>
Source§impl VectorFromWasmAbi for CoresStatewhere
Self: DeserializeOwned,
impl VectorFromWasmAbi for CoresStatewhere
Self: DeserializeOwned,
type Abi = <JsType as VectorFromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]>
Source§impl VectorIntoWasmAbi for CoresStatewhere
CoresState: Serialize,
impl VectorIntoWasmAbi for CoresStatewhere
CoresState: Serialize,
type Abi = <JsType as VectorIntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi
Source§impl WasmDescribeVector for CoresState
impl WasmDescribeVector for CoresState
impl Eq for CoresState
impl StructuralPartialEq for CoresState
Auto Trait Implementations§
impl Freeze for CoresState
impl RefUnwindSafe for CoresState
impl Send for CoresState
impl Sync for CoresState
impl Unpin for CoresState
impl UnwindSafe for CoresState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.