add errors doc for set rhai fn

This commit is contained in:
l1npengtul 2022-10-31 22:20:43 +09:00
parent 3e6a3a2759
commit ec332b4e49

View File

@ -29,6 +29,9 @@ static AHASH_SEED: OnceLock<Option<[u64; 4]>> = OnceLock::new();
/// - You can only call this function **ONCE** for the whole of your program execution. /// - You can only call this function **ONCE** for the whole of your program execution.
/// - You should gracefully handle the `Err(())`. /// - You should gracefully handle the `Err(())`.
/// - You **MUST** call this before **ANY** Rhai operation occurs (e.g. creating an [`Engine`]). /// - You **MUST** call this before **ANY** Rhai operation occurs (e.g. creating an [`Engine`]).
///
/// # Errors
/// This will error if the AHashSeed is already set.
pub fn set_rhai_ahash_seed(new_seed: Option<[u64; 4]>) -> Result<(), Option<[u64; 4]>> { pub fn set_rhai_ahash_seed(new_seed: Option<[u64; 4]>) -> Result<(), Option<[u64; 4]>> {
AHASH_SEED.set(new_seed) AHASH_SEED.set(new_seed)
} }