doc fixes + wasm fix

This commit is contained in:
Dmitry Stepanov
2025-04-12 21:32:47 +03:00
parent e4cc4cbd23
commit 58abb905b0
5 changed files with 17 additions and 17 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ use std::{
sync::Arc,
};
/// A Blackboard is a mapping from TypeId to value that allows a [Visitor] to store
/// A Blackboard is a mapping from TypeId to value that allows a [`crate::visitor::Visitor`] to store
/// a particular value for each registered type.
#[derive(Default)]
pub struct Blackboard {
+5 -4
View File
@@ -27,7 +27,7 @@ use std::{
string::FromUtf8Error,
};
/// Errors that may occur while reading or writing [Visitor].
/// Errors that may occur while reading or writing [`crate::visitor::Visitor`].
#[derive(Debug)]
pub enum VisitError {
/// An [std::io::Error] occured while reading or writing a file with Visitor data.
@@ -54,11 +54,12 @@ pub enum VisitError {
RegionDoesNotExist(String),
/// The Visitor tried to leave is current node, but somehow it had no current node. This should never happen.
NoActiveNode,
/// The [Visitor::MAGIC] bytes were missing from the beginning of encoded Visitor data.
/// The [`crate::Visitor::MAGIC_BINARY`] or [`crate::Visitor::MAGIC_ASCII`] bytes were missing
/// from the beginning of encoded Visitor data.
NotSupportedFormat,
/// Some sequence of bytes was not in UTF8 format.
InvalidName,
/// Visitor data can be self-referential, such as when the data contains multiple [Rc] references
/// Visitor data can be self-referential, such as when the data contains multiple `Rc` references
/// to a single shared value. This causes the visitor to store the data once and then later references
/// to the same value point back to its first occurrence. This error occurs if one of these references
/// points to a value of the wrong type.
@@ -67,7 +68,7 @@ pub enum VisitError {
RefCellAlreadyMutableBorrowed,
/// A plain-text error message that could indicate almost anything.
User(String),
/// [Rc] and [Arc] values store an "Id" value in the Visitor data which is based in their internal pointer.
/// `Rc` and `Arc` values store an "Id" value in the Visitor data which is based in their internal pointer.
/// This error indicates that while reading this data, one of those Id values was discovered by be 0.
UnexpectedRcNullIndex,
/// A poison error occurred while trying to visit a mutex.
+6 -6
View File
@@ -21,10 +21,10 @@
use nalgebra::{Matrix2, Matrix3, Matrix4, UnitComplex, UnitQuaternion, Vector2, Vector3, Vector4};
use uuid::Uuid;
/// The internal data format of [Visitor]. Fields are limited to being one of these types.
/// This means that all [Visit] values must be built from some assortment
/// The internal data format of [`crate::visitor::Visitor`]. Fields are limited to being one of these types.
/// This means that all [`crate::visitor::Visit`] values must be built from some assortment
/// of these types.
/// Fields can be accessed from a visitor using [Visit::visit] on a variable with the
/// Fields can be accessed from a visitor using [`crate::visitor::Visit::visit`] on a variable with the
/// same type as the field.
#[derive(PartialEq, Debug)]
pub enum FieldKind {
@@ -47,10 +47,10 @@ pub enum FieldKind {
Matrix3(Matrix3<f32>),
Uuid(Uuid),
UnitComplex(UnitComplex<f32>),
/// A representation for arrays of [Pod] types as a `Vec<u8>`.
/// A representation for arrays of [`crate::visitor::pod::Pod`] types as a `Vec<u8>`.
PodArray {
/// A code to identify the Pod type of the elements of the array.
/// Taken from [Pod::type_id].
/// Taken from [`crate::visitor::pod::Pod::type_id`].
type_id: u8,
/// The number of bytes in each array element.
element_size: u32,
@@ -102,7 +102,7 @@ pub enum FieldKind {
/// Values within a visitor are constructed from Fields.
/// Each Field has a name and a value. The name is used as a key to access the value
/// within the visitor using the [Visit::visit] method, so each field within a value
/// within the visitor using the [`crate::Visit::visit`] method, so each field within a value
/// must have a unique name.
#[derive(PartialEq, Debug)]
pub struct Field {
+4 -6
View File
@@ -44,15 +44,13 @@ pub mod prelude {
pub use crate::visitor::error::VisitError;
}
use crate::visitor::reader::AsciiReader;
use crate::visitor::writer::AsciiWriter;
use crate::{
array_as_u8_slice_mut,
io::{self},
pool::{Handle, Pool},
visitor::{
reader::{BinaryReader, Reader},
writer::{BinaryWriter, Writer},
reader::{AsciiReader, BinaryReader, Reader},
writer::{AsciiWriter, BinaryWriter, Writer},
},
};
use bitflags::bitflags;
@@ -61,9 +59,9 @@ use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use error::VisitError;
use field::{Field, FieldKind};
use fxhash::FxHashMap;
use std::fmt::{Debug, Formatter};
use std::{
any::Any,
fmt::{Debug, Formatter},
fs::File,
hash::Hash,
io::{BufWriter, Cursor, Read, Write},
@@ -75,7 +73,7 @@ use std::{
/// Proxy struct for plain data, we can't use `Vec<u8>` directly,
/// because it will serialize each byte as separate node.
/// BinaryBlob stores data very much like [PodVecView] except that BinaryBlob
/// BinaryBlob stores data very much like [`crate::visitor::pod::PodVecView`] except that BinaryBlob
/// has less type safety. In practice it is used with T = u8 for Strings and Paths,
/// but it accepts any type T that is Copy, and it lacks the type_id system that
/// PodVecView has for checking that the data it is reading comes from the expected type.
+1
View File
@@ -415,6 +415,7 @@ impl ResourceManagerState {
// WASM can only try to load the existing registry.
#[cfg(target_arch = "wasm32")]
{
use crate::registry::RegistryContainerExt;
// Then load the registry.
match crate::registry::RegistryContainer::load_from_file(&path, &*resource_io).await
{