Skip to main content

Crate hashavatar

Crate hashavatar 

Source
Expand description

Procedural, asset-free avatar generation driven by stable identity hashes.

The crate produces deterministic avatar images from an input identifier without shipping image packs, sprites, or third-party artwork. All visual output is drawn from code using geometric primitives.

Typical usage:

use hashavatar::prelude::*;

let bytes = AvatarBuilder::for_id("robot@hashavatar.app")
    .size(256, 256)
    .kind(AvatarKind::Robot)
    .background(AvatarBackground::Transparent)
    .encode(AvatarOutputFormat::WebP)?;

Modules§

prelude
Common imports for application code using the high-level avatar APIs.

Structs§

AvatarBuilder
Fluent high-level API for common avatar rendering paths.
AvatarIdentity
A stable avatar identity derived from a fixed 64-byte digest.
AvatarIdentityError
AvatarIdentityOptions
Options for deriving a stable avatar identity.
AvatarNamespace
AvatarOptions
AvatarRenderResourceBudget
Resource budget estimate for raster rendering.
AvatarSpec
Input parameters for a generated avatar image.
AvatarSpecError
AvatarStyleOptions
Full avatar style selection including the baseline kind/background and optional visual layers.
CatAvatar
Cat-face avatar renderer built from simple geometric primitives.
Color
RGBA color helper for concise shape drawing.
HashedCatAvatar
Cat-face avatar renderer driven by a stable identity digest.
HashedDogAvatar
HashedRobotAvatar

Enums§

AvatarAccessory
Optional avatar accessory layer.
AvatarBackground
Canvas background mode for raster and SVG avatar output.
AvatarColor
Optional avatar accent color palette.
AvatarError
Unified error type for high-level avatar APIs.
AvatarExpression
Optional avatar expression layer.
AvatarIdentityComponent
AvatarKind
Avatar family selection.
AvatarOutputFormat
Export formats for encoded avatar assets.
AvatarRenderError
AvatarShape
Optional frame shape for the generated avatar.

Constants§

AVATAR_RGBA_BYTES_PER_PIXEL
Number of bytes in one RGBA8 raster pixel.
AVATAR_STYLE_ACCESSORY_BYTE
Identity digest byte used for automatic accessory selection.
AVATAR_STYLE_BACKGROUND_BYTE
Identity digest byte used for automatic background selection.
AVATAR_STYLE_COLOR_BYTE
Identity digest byte used for automatic color-palette selection.
AVATAR_STYLE_EXPRESSION_BYTE
Identity digest byte used for automatic expression selection.
AVATAR_STYLE_KIND_BYTE
Identity digest byte used for automatic avatar family selection.
AVATAR_STYLE_SHAPE_BYTE
Identity digest byte used for automatic frame-shape selection.
AVATAR_STYLE_VERSION
Rendering contract version for deterministic avatars.
MAX_AVATAR_DIMENSION
Largest supported raster or SVG dimension.
MAX_AVATAR_ID_BYTES
Largest supported identity input in bytes.
MAX_AVATAR_NAMESPACE_COMPONENT_BYTES
Largest supported namespace component in bytes.
MAX_AVATAR_PIXELS
Largest supported raster pixel count.
MAX_AVATAR_RGBA_BYTES
Largest supported raw RGBA8 image buffer size before encoder overhead.
MIN_AVATAR_DIMENSION
Smallest supported raster or SVG dimension.

Traits§

AvatarRenderer
Trait for renderers that can draw reusable avatar styles onto an image buffer.

Functions§

encode_avatar
Render and encode an avatar into memory.
encode_avatar_auto_for_id
encode_avatar_auto_for_namespace
encode_avatar_auto_with_identity_options
encode_avatar_for_id
encode_avatar_for_namespace
encode_avatar_style_for_id
encode_avatar_style_for_namespace
encode_avatar_style_with_identity_options
encode_avatar_with_identity_options
encode_cat_avatar
Render and encode a cat avatar into memory.
encode_cat_avatar_for_id
Render and encode a cat avatar for a stable identity string.
render_alien_avatar_for_identity
render_astronaut_avatar_for_identity
render_avatar_auto_for_id
Render an avatar image with all public style choices derived from distinct identity digest bytes.
render_avatar_auto_for_namespace
render_avatar_auto_with_identity_options
render_avatar_for_id
Render an avatar image directly without encoding it.
render_avatar_for_namespace
render_avatar_style_for_id
Render an avatar image with explicit visual layer style options.
render_avatar_style_for_namespace
render_avatar_style_with_identity_options
render_avatar_svg_auto_for_id
Render an avatar SVG with all public style choices derived from distinct identity digest bytes.
render_avatar_svg_auto_for_namespace
render_avatar_svg_auto_with_identity_options
render_avatar_svg_for_id
Render an avatar as a compact SVG string.
render_avatar_svg_for_namespace
render_avatar_svg_style_for_id
Render an avatar with explicit visual layer style options as a compact SVG string.
render_avatar_svg_style_for_namespace
render_avatar_svg_style_with_identity_options
render_avatar_svg_with_identity_options
render_avatar_with_identity_options
render_bear_avatar_for_identity
render_bird_avatar_for_identity
render_cactus_avatar_for_identity
Render a cactus avatar from a stable identity.
render_cat_avatar
Render a cat face avatar into an RGBA image.
render_cat_avatar_for_identity
Render a cat face avatar from a stable identity digest.
render_cat_avatar_for_identity_with_background
render_coffee_cup_avatar_for_identity
render_cupcake_avatar_for_identity
Render a cupcake avatar from a stable identity.
render_diamond_avatar_for_identity
render_dog_avatar_for_identity
render_dragon_avatar_for_identity
render_fox_avatar_for_identity
render_frog_avatar_for_identity
Render a frog avatar from a stable identity.
render_ghost_avatar_for_identity
render_icecream_avatar_for_identity
Render an ice cream cone avatar from a stable identity.
render_knight_avatar_for_identity
Render a knight helmet avatar from a stable identity.
render_monster_avatar_for_identity
render_mushroom_avatar_for_identity
Render a mushroom avatar from a stable identity.
render_ninja_avatar_for_identity
render_octopus_avatar_for_identity
Render an octopus avatar from a stable identity.
render_panda_avatar_for_identity
Render a panda avatar from a stable identity.
render_paws_avatar_for_identity
render_penguin_avatar_for_identity
render_pizza_avatar_for_identity
Render a pizza-slice avatar from a stable identity.
render_planet_avatar_for_identity
Render a ringed planet avatar from a stable identity.
render_robot_avatar_for_identity
render_rocket_avatar_for_identity
Render a rocket avatar from a stable identity.
render_shield_avatar_for_identity
render_skull_avatar_for_identity
render_slime_avatar_for_identity
render_wizard_avatar_for_identity