tiger_lib::block

Struct Block

Source
pub struct Block {
    v: Vec<BlockItem>,
    pub tag: Option<Box<Token>>,
    pub loc: Loc,
    pub source: Option<Box<(Vec<MacroComponent>, PdxfileMemory)>>,
}
Expand description

This type represents the most basic structural element of Pdx script code. Blocks are delimited by { and }. An entire file is also a Block.

A Block can contain a mix of these kinds of items:

  • Assignments: key = value
  • Definitions: key = { ... }
  • Loose sub-blocks: { ... } { ... } ...
  • Loose values: value value ...
  • Comparisons: key < value for a variety of comparators, including = for equality
  • key < { ... } is accepted by the parser but is not used anywhere

The same key can occur multiple times in a block. If a single field is requested and its key occurs multiple times, the last instance is returned (which is how the game usually resolves this).

Fields§

§v: Vec<BlockItem>

The contents of this block.

§tag: Option<Box<Token>>

The tag is a short string that precedes a block, as in color = hsv { 0.5 0.5 1.0 }. Only a small number of hardcoded tags are parsed this way. It is in a Box to save space in blocks that don’t have a tag, which is most of them.

§loc: Loc

The location of the start of the block. Used mostly for error reporting.

§source: Option<Box<(Vec<MacroComponent>, PdxfileMemory)>>

If the block is a top-level block and contains macro substitutions, this field will hold the original source for re-parsing. The source has already been split into a vec that alternates content with macro parameters. It is in a Box to save space (80 bytes) from blocks that don’t contain macro substitutions, which is most of them.

Implementations§

Source§

impl Block

Source

pub fn new(loc: Loc) -> Self

Open a new Block at the given location.

Source

pub fn add_value(&mut self, value: Token)

Add a loose value to this Block. Mostly used by the parser.

Source

pub fn add_block(&mut self, block: Block)

Add a loose sub-block to this Block. Mostly used by the parser.

Source

pub fn add_key_bv(&mut self, key: Token, cmp: Comparator, value: BV)

Add a key = value or key = { ... } field to this Block. Mostly used by the parser.

Source

pub fn add_item(&mut self, item: BlockItem)

Add a BlockItem to this Block. It can contain any of the variations of things that a Block can hold.

Source

pub fn add_item_check_tag(&mut self, item: BlockItem)

Add a BlockItem to this Block. If it is a BlockItem::Block and the previous item is a key = tag, where the tag is one of a predefined set of strings, then combine the block with that previous item.

Source

pub fn append(&mut self, other: &mut Block)

Combine two blocks by adding the contents of other to this block. To avoid lots of cloning, other will be emptied in the process.

Source

pub fn get_field_value(&self, name: &str) -> Option<&Token>

Get the value of a single name = value assignment.

Source

pub fn field_value_is(&self, name: &str, value: &str) -> bool

Check if name is a field that has the literal string value as its value.

Source

pub fn get_field_bool(&self, name: &str) -> Option<bool>

Get the value of a literal boolean field

Source

pub fn get_field_integer(&self, name: &str) -> Option<i64>

Get the value of a literal integer field

Source

pub fn get_field_date(&self, name: &str) -> Option<Date>

Get the value of a literal date field

Source

pub fn get_field_values(&self, name: &str) -> Vec<&Token>

Get all the values of name = value assignments in this block

TODO: should be an iterator

Source

pub fn get_field_block(&self, name: &str) -> Option<&Block>

Get the block of a name = { ... } definition

Source

pub fn get_field_blocks(&self, name: &str) -> Vec<&Block>

Get all the blocks of name = { ... } definitions in this block

Source

pub fn get_field_list(&self, name: &str) -> Option<Vec<Token>>

Get the values of a single name = { value value ... } list

Source

pub fn get_multi_field_list(&self, name: &str) -> Vec<Token>

Get the combined values of any number of name = { value value ... } list

Source

pub fn get_field(&self, name: &str) -> Option<&BV>

Get the value or block on the right-hand side of a field name.

Source

pub fn get_key(&self, name: &str) -> Option<&Token>

Get the key of a field name in the Block. The string value of the key will be equal to name, but it can be useful to get this key as a Token with its location.

Source

pub fn get_keys(&self, name: &str) -> Vec<&Token>

Get all the keys of fields with key name. The string values of these keys will be equal to name, but it can be useful to get these keys as Token with their locations.

Source

pub fn has_key(&self, name: &str) -> bool

Return true iff the name occurs in this block at least once as a field key.

Source

pub fn has_key_recursive(&self, name: &str) -> bool

Source

pub fn count_keys(&self, name: &str) -> usize

Return the number of times name occurs in this block as a field key.

Source

pub fn iter_items(&self) -> Iter<'_, BlockItem>

Return an iterator over the contents of this block.

Source

pub fn drain(&mut self) -> Drain<'_, BlockItem>

Return a destructive iterator over the contents of this block. It will give ownership of the returned BlockItem objects.

Source

pub fn iter_fields(&self) -> IterFields<'_>

Return an iterator over all the key = ... fields in this block, ignoring the loose values and loose blocks.

Source

pub fn iter_fields_warn(&self) -> IterFields<'_>

Return an iterator over all the key = ... fields in this block, while warning about loose values and loose blocks.

Source

pub fn iter_assignments(&self) -> IterAssignments<'_>

Return an iterator over all the key = value fields in this block, ignoring other kinds of contents.

Source

pub fn iter_assignments_warn(&self) -> IterAssignments<'_>

Return an iterator over all the key = value fields in this block, while warning about every other kind of content.

Source

pub fn iter_definitions(&self) -> IterDefinitions<'_>

Return an iterator over all the key = { ... } fields in this block, ignoring other kinds of contents.

Source

pub fn iter_definitions_warn(&self) -> IterDefinitions<'_>

Return an iterator over all the key = { ... } fields in this block, while warning about every other kind of content.

Source

pub fn iter_assignments_and_definitions( &self, ) -> IterAssignmentsAndDefinitions<'_>

Return an iterator over all the key = value and key = { ... } fields in this block, ignoring every other kind of content. It differs from Block::iter_fields in that it requires the comparator to be =.

Source

pub fn iter_assignments_and_definitions_warn( &self, ) -> IterAssignmentsAndDefinitions<'_>

Return an iterator over all the key = value and key = { ... } fields in this block, while warning about every other kind of content. It differs from Block::iter_fields_warn in that it requires the comparator to be =.

Source

pub fn drain_definitions_warn(&mut self) -> DrainDefinitions<'_>

Like Block::iter_definitions_warn but it’s a destructive iterator that gives ownership over the returned definitions.

Source

pub fn drain_assignments_warn(&mut self) -> DrainAssignments<'_>

Like Block::iter_assignments_warn but it’s a destructive iterator that gives ownership over the returned assignments.

Source

pub fn iter_values(&self) -> IterValues<'_>

Iterate over the loose values in the block.

Source

pub fn iter_values_warn(&self) -> IterValues<'_>

Iterate over the loose values in the block, while warning about everything else.

Source

pub fn iter_blocks(&self) -> IterBlocks<'_>

Iterate over the loose sub-blocks in the block.

Source

pub fn iter_blocks_warn(&self) -> IterBlocks<'_>

Iterate over the loose sub-blocks in the block, while warning about everything else.

Source

pub fn get_field_at_date(&self, name: &str, date: Date) -> Option<&BV>

Search through the history fields in this block and return the block or value the field name would have at the given date. The field value that’s directly in this block, not in any history block, is considered to be the field value at the beginning of time. History fields are ones that have a date as the key, like 900.1.1 = { ... }.

Source

pub fn get_field_value_at_date(&self, name: &str, date: Date) -> Option<&Token>

Just like Block::get_field_at_date but only for fields that have values (not blocks).

Source

pub fn macro_parms(&self) -> Vec<&'static str>

Return a sorted vector of macro parameters taken by this block. Macro parameters are between $ like $CHARACTER$.

Source

pub fn expand_macro( &self, args: &[(&str, Token)], loc: Loc, global: &PdxfileMemory, ) -> Option<Block>

Expand a block that has macro parameters by substituting arguments for those parameters, then re-parsing the script, that links the expanded content back to loc.

Source

pub fn equivalent(&self, other: &Self) -> bool

Return true iff this block has the same block items in the same order as other, including equivalence of blocks inside them.

Source

pub fn condense_tag(self, tag: &str) -> Self

Create a version of this block where the tag is combined with a token that follows it. Example: color1 = list colorlist becomes color1 = list"colorlist (where the " character is used as the separator because it can’t show up in normal parsing).

This function is used as a last resort when validating awkward syntax.

Trait Implementations§

Source§

impl Clone for Block

Source§

fn clone(&self) -> Block

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Block

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ErrorLoc for &Block

Source§

impl ErrorLoc for Block

Source§

impl FileHandler<Block> for CharacterInteractionCategories

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

impl FileHandler<Block> for Characters

Source§

fn config(&mut self, config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for Coas

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for DataBindings

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for Decisions

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for Defines

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for Doctrines

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

impl FileHandler<Block> for Effects

Source§

fn config(&mut self, config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for Events

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for GameConcepts

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

impl FileHandler<Block> for Gui

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

impl FileHandler<Block> for History

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for MenAtArmsTypes

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

impl FileHandler<Block> for Musics

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for OnActions

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for ProvinceHistories

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for ProvinceProperties

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for ProvinceTerrains

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for ScriptValues

Source§

fn config(&mut self, config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for ScriptedLists

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for ScriptedModifiers

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for TitleHistories

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for Titles

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for Traits

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

impl FileHandler<Block> for Triggers

Source§

fn config(&mut self, config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.
Source§

impl FileHandler<Block> for Wars

Source§

fn subpath(&self) -> PathBuf

Which files this handler is interested in. This is a directory prefix of files it wants to handle, relative to the mod or vanilla root.
Source§

fn load_file(&self, entry: &FileEntry, parser: &ParserMemory) -> Option<Block>

This is called for each matching file, in arbitrary order. If a T is returned, it will be passed to handle_file later. Since load_file is executed multi-threaded while handle_file is single-threaded, try to do the heavy work in this function.
Source§

fn handle_file(&mut self, _entry: &FileEntry, block: Block)

This is called for each matching file in turn, in lexical order. That’s the order in which the CK3 game engine loads them too.
Source§

fn config(&mut self, _config: &Block)

The FileHandler can read settings it needs from the ck3-tiger config.
Source§

fn finalize(&mut self)

This is called after all files have been handled. The FileHandler can generate indexes, perform full-data checks, etc.

Auto Trait Implementations§

§

impl Freeze for Block

§

impl RefUnwindSafe for Block

§

impl Send for Block

§

impl Sync for Block

§

impl Unpin for Block

§

impl UnwindSafe for Block

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsAny for T
where T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

§

fn type_name(&self) -> &'static str

Gets the type name of self
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> Downcast for T
where T: AsAny + ?Sized,

§

fn is<T>(&self) -> bool
where T: AsAny,

Returns true if the boxed type is the same as T. Read more
§

fn downcast_ref<T>(&self) -> Option<&T>
where T: AsAny,

Forward to the method defined on the type Any.
§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: AsAny,

Forward to the method defined on the type Any.
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.