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§

AvatarAssetKey
Domain-separated key for one complete unencoded avatar render tuple.
AvatarBuilder
Fluent high-level API for common avatar rendering paths.
AvatarFamilyCapabilities
Declared style capabilities for one built-in avatar family.
AvatarFamilyCapabilityEntry
One entry in the frozen family capability manifest.
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.
AvatarRequest
Immutable input to the prepared-avatar preview API.
AvatarRequestBuilder
Builder for AvatarRequest.
AvatarSpec
Input parameters for a generated avatar image.
AvatarSpecError
AvatarStyleOptions
Full avatar style selection including the baseline kind/background and optional visual layers.
AvatarStyleValidationError
Error returned when an explicit style requests a layer a family cannot use.
BuildEncodedAssetKey
Domain-separated deployment-specific key for one encoded avatar asset tuple.
CatAvatar
Cat-face avatar renderer built from simple geometric primitives.
CatalogEntry
Stable catalog metadata for one built-in value.
CatalogVersion
Frozen identifier for a built-in trait catalog.
Color
RGBA color helper for concise shape drawing.
EncoderBuildId
Caller-supplied digest identifying one deployed encoder build.
HashedCatAvatar
Cat-face avatar renderer driven by a stable identity digest.
HashedDogAvatar
HashedRobotAvatar
IdentityCacheKey
Domain-separated public cache key for one derived avatar identity.
LayoutReport
Stable preparation report for the effective 1.x layout contract.
PreparedAvatar
Immutable prepared 1.x avatar request.
RasterSurfaceMut
Mutable caller-owned RGBA8 surface with an explicit row stride.
RenderContractId
Frozen identifier for the renderer behavior that determines avatar pixels.
ResolvedStyle
Requested and effective style bound to a prepared avatar.
ResourceBudget
Conservative known memory requirements for the 1.x preview adapters.
SemanticEncodedAssetKey
Domain-separated semantic request key for one encoded avatar asset tuple.
StrictAvatarBuilder
Opt-in high-level API that rejects unsupported explicit style layers.

Enums§

AvatarAccessory
Optional avatar accessory layer.
AvatarBackground
Canvas background mode for raster and SVG avatar output.
AvatarColor
Optional avatar accent color palette.
AvatarCompatibilityMode
Style compatibility policy used while preparing an avatar request.
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
AvatarRequestError
Error returned when request preparation fails.
AvatarShape
Optional frame shape for the generated avatar.
AvatarStyleLayer
Style layer that can be rejected by strict family validation.
RasterSurfaceError
Error returned by caller-surface construction or rendering.
StrictAvatarError
Error returned by opt-in strict builder operations.

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.
LEGACY_AVATAR_ACCESSORIES
LEGACY_AVATAR_BACKGROUNDS
LEGACY_AVATAR_COLORS
LEGACY_AVATAR_EXPRESSIONS
LEGACY_AVATAR_KINDS
LEGACY_AVATAR_SHAPES
LEGACY_FAMILY_CAPABILITIES
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
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_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