[][src]Struct kerbalobjects::StringTable

pub struct StringTable { /* fields omitted */ }

Represents a list of strings in a KO file that can be used as the names of symbols or as file comments or notes

Implementations

impl StringTable[src]

pub fn new(name: &str) -> StringTable[src]

Creates a new string table with the specified name

pub fn read(
    reader: &mut KOFileReader,
    header: &SectionHeader
) -> Result<StringTable, Box<dyn Error>>
[src]

Reads the string table from the KO file reader, and returns it

pub fn write(&self, writer: &mut KOFileWriter) -> Result<(), Box<dyn Error>>[src]

Writes the entire string table to the KO file

pub fn size(&self) -> u32[src]

Returns the size of this string table in bytes

pub fn add(&mut self, s: &str) -> usize[src]

Adds a string to the string table This function checks first to see if the string already exists in the string table, which could possibly save space. If it does, it returns the index of that string. If it doesn't find it, the string is added to the string table.

pub fn add_no_check(&mut self, s: &str) -> usize[src]

Adds a string to the string table unconditionally Returns the index of the string in the string table See add()

pub fn get(&self, index: usize) -> Result<&String, Box<dyn Error>>[src]

Returns the specific string at an index into the internal vector of strings

pub fn name(&self) -> &String[src]

Returns the name of this string table

pub fn get_strings(&self) -> &Vec<String>[src]

Returns a reference to the internal vector containing all strings in this string table

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.