Skip to main content

Crate use_preact

Crate use_preact 

Source
Expand description

§use-preact

Preact component metadata primitives for RustUse.

§Experimental

use-preact is experimental while use-js remains below 0.3.0.

§Example

use use_preact::{PreactComponentName, PreactHookName, PreactJsxRuntime};

let component = PreactComponentName::new("AppShell")?;
let hook = PreactHookName::new("useSignal")?;

assert_eq!(component.as_str(), "AppShell");
assert_eq!(hook.as_str(), "useSignal");
assert_eq!(PreactJsxRuntime::Automatic.as_str(), "automatic");

§Scope

  • Preact component, hook, JSX runtime, file-kind, and compat-mode metadata.
  • Lightweight component and hook name validation.

§Non-goals

  • Rendering behavior.
  • JSX parsing.
  • Compatibility runtime behavior.

§License

Licensed under either Apache-2.0 or MIT.

Structs§

PreactComponentName
Validated Preact component name metadata.
PreactHookName
Validated Preact hook name metadata.

Enums§

PreactCompatMode
Preact compatibility mode labels.
PreactFileKind
Preact file-kind labels.
PreactJsxRuntime
Preact JSX runtime labels.
PreactNameError
Error returned when Preact metadata is invalid.