pub struct BudgetAllocator {
pub total_budget_bytes: u64,
pub scenes: Vec<SceneSegment>,
}Expand description
Allocates a total byte budget proportionally across scenes, weighted by each scene’s complexity.
Fields§
§total_budget_bytes: u64Total available byte budget.
scenes: Vec<SceneSegment>Scenes to allocate budget across.
Implementations§
Source§impl BudgetAllocator
impl BudgetAllocator
Sourcepub fn new(total_budget_bytes: u64, scenes: Vec<SceneSegment>) -> Self
pub fn new(total_budget_bytes: u64, scenes: Vec<SceneSegment>) -> Self
Creates a new allocator.
Sourcepub fn allocate(&self) -> Vec<u64>
pub fn allocate(&self) -> Vec<u64>
Returns per-scene byte budgets, summing to at most total_budget_bytes.
Allocation weight for scene i:
w_i = duration_i × (0.5 + complexity_i)
Each scene receives budget_i = total × w_i / Σw.
Sourcepub fn allocated_total(&self) -> u64
pub fn allocated_total(&self) -> u64
Returns the total bytes allocated (should be ≤ total_budget_bytes).
Trait Implementations§
Source§impl Clone for BudgetAllocator
impl Clone for BudgetAllocator
Source§fn clone(&self) -> BudgetAllocator
fn clone(&self) -> BudgetAllocator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BudgetAllocator
impl RefUnwindSafe for BudgetAllocator
impl Send for BudgetAllocator
impl Sync for BudgetAllocator
impl Unpin for BudgetAllocator
impl UnsafeUnpin for BudgetAllocator
impl UnwindSafe for BudgetAllocator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more