yarnspinner/
lib.rs

1//! # Yarn Spinner for Rust
2//! The friendly dialogue creation tool for Rust.
3//!
4//! This crate provides a compiler and runtime that can be used standalone, but will most likely be used by a crate providing the functionality
5//! to a game engine. For example, [Bevy](https://bevyengine.org/) engine support is given by the [`bevy_yarnspinner`](https://crates.io/crates/bevy_yarnspinner) crate.
6#![warn(missing_docs, missing_debug_implementations)]
7
8pub use log;
9
10pub mod prelude {
11    //! Everything you need to get started using Yarn Spinner.
12    pub use crate::compiler::{
13        Compilation, CompilationType, Compiler as YarnCompiler, CompilerError, File as YarnFile,
14        LineInfo, Result as YarnCompilerResult, StringInfo,
15    };
16    pub use crate::core::{
17        yarn_library, IntoYarnValueFromNonYarnValue, Library as YarnLibrary, LineId,
18        Program as YarnProgram, YarnFn, YarnValue,
19    };
20    pub use crate::runtime::{
21        Command as YarnCommand, CompiledProgramAnalyser as YarnAnalyser,
22        Context as YarnAnalysisContext, Dialogue, DialogueError, DialogueEvent, DialogueOption,
23        Language, Line as YarnLine, MarkupAttribute, MarkupValue, OptionId,
24        Result as YarnRuntimeResult, StringTable, TextProvider, VariableStorage,
25    };
26}
27
28pub mod core {
29    //! Core types and traits that are used by both the compiler and runtime.
30    pub use yarnspinner_core::prelude::{
31        optionality, yarn_fn_type, yarn_library, Header, Instruction,
32        IntoYarnValueFromNonYarnValue, InvalidOpCodeError, Library, LineId, Node, Position,
33        Program, Type, UntypedYarnFn, YarnFn, YarnFnParam, YarnFnParamItem, YarnValue,
34        YarnValueCastError, YarnValueWrapper, YarnValueWrapperIter,
35    };
36}
37pub mod compiler {
38    //! Types and traits used by the compiler, in particular the [`Compiler`] struct.
39    pub use yarnspinner_compiler::prelude::*;
40    pub use yarnspinner_compiler::Result;
41}
42
43pub mod runtime {
44    //! Types and traits used by the runtime, in particular the [`Dialogue`] struct.
45    pub use yarnspinner_runtime::markup::{
46        MarkupAttribute, MarkupParseError, MarkupValue, CHARACTER_ATTRIBUTE,
47        CHARACTER_ATTRIBUTE_NAME_PROPERTY, TRIM_WHITESPACE_PROPERTY,
48    };
49    pub use yarnspinner_runtime::prelude::*;
50    pub use yarnspinner_runtime::Result;
51}