mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
16 lines
479 B
Rust
16 lines
479 B
Rust
// Copyright 2022 The Vello authors
|
|
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
|
|
/// Interface for a monoid. The default value must be the identity of
|
|
/// the monoid.
|
|
pub trait Monoid: Default {
|
|
/// The source value for constructing the monoid.
|
|
type SourceValue;
|
|
|
|
/// Creates a monoid from a given value.
|
|
fn new(value: Self::SourceValue) -> Self;
|
|
|
|
/// Combines two monoids. This operation must be associative.
|
|
fn combine(&self, other: &Self) -> Self;
|
|
}
|