Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the From trait for PageUsage
Browse files Browse the repository at this point in the history
ryoqun committed Feb 28, 2024
1 parent c682aee commit 1d99c44
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions unified-scheduler-logic/src/lib.rs
Original file line number Diff line number Diff line change
@@ -384,8 +384,8 @@ enum PageUsage {
}
const_assert_eq!(mem::size_of::<PageUsage>(), 8);

impl PageUsage {
fn from_requested_usage(requested_usage: RequestedUsage) -> Self {
impl From<RequestedUsage> for PageUsage {
fn from(requested_usage: RequestedUsage) -> Self {
match requested_usage {
RequestedUsage::Readonly => PageUsage::Readonly(ShortCounter::one()),
RequestedUsage::Writable => PageUsage::Writable,
@@ -561,7 +561,7 @@ impl SchedulingStateMachine {

fn try_lock_page(page: &PageInner, requested_usage: RequestedUsage) -> LockResult {
match page.usage {
PageUsage::Unused => LockResult::Ok(PageUsage::from_requested_usage(requested_usage)),
PageUsage::Unused => LockResult::Ok(PageUsage::from(requested_usage)),
PageUsage::Readonly(count) => match requested_usage {
RequestedUsage::Readonly => LockResult::Ok(PageUsage::Readonly(count.increment())),
RequestedUsage::Writable => LockResult::Err(()),

0 comments on commit 1d99c44

Please sign in to comment.