pub struct StateFile {
pub current_manifest_pr: Option<u64>,
pub branch_to_pr: HashMap<String, u64>,
pub pr_links: HashMap<String, Vec<LinkedPR>>,
}Expand description
The persistent state file structure
Fields§
§current_manifest_pr: Option<u64>Current manifest PR being worked on
branch_to_pr: HashMap<String, u64>Map: branch name -> manifest PR number
pr_links: HashMap<String, Vec<LinkedPR>>Map: manifest PR number -> linked PRs
Implementations§
Source§impl StateFile
impl StateFile
Sourcepub fn parse(json: &str) -> Result<Self, StateError>
pub fn parse(json: &str) -> Result<Self, StateError>
Parse state from a JSON string
Sourcepub fn save<P: AsRef<Path>>(&self, path: P) -> Result<(), StateError>
pub fn save<P: AsRef<Path>>(&self, path: P) -> Result<(), StateError>
Save state to a JSON file
Sourcepub fn get_pr_for_branch(&self, branch: &str) -> Option<u64>
pub fn get_pr_for_branch(&self, branch: &str) -> Option<u64>
Get the PR number for a branch
Sourcepub fn set_pr_for_branch(&mut self, branch: &str, pr_number: u64)
pub fn set_pr_for_branch(&mut self, branch: &str, pr_number: u64)
Set the PR number for a branch
Sourcepub fn get_linked_prs(&self, manifest_pr: u64) -> Option<&Vec<LinkedPR>>
pub fn get_linked_prs(&self, manifest_pr: u64) -> Option<&Vec<LinkedPR>>
Get linked PRs for a manifest PR
Sourcepub fn set_linked_prs(&mut self, manifest_pr: u64, links: Vec<LinkedPR>)
pub fn set_linked_prs(&mut self, manifest_pr: u64, links: Vec<LinkedPR>)
Set linked PRs for a manifest PR
Sourcepub fn add_linked_pr(&mut self, manifest_pr: u64, link: LinkedPR)
pub fn add_linked_pr(&mut self, manifest_pr: u64, link: LinkedPR)
Add a linked PR to a manifest PR
Sourcepub fn update_linked_pr<F>(
&mut self,
manifest_pr: u64,
repo_name: &str,
update_fn: F,
)
pub fn update_linked_pr<F>( &mut self, manifest_pr: u64, repo_name: &str, update_fn: F, )
Update a linked PR’s status
Sourcepub fn remove_branch(&mut self, branch: &str)
pub fn remove_branch(&mut self, branch: &str)
Remove all state for a branch
Sourcepub fn all_linked_prs_ready(&self, manifest_pr: u64) -> bool
pub fn all_linked_prs_ready(&self, manifest_pr: u64) -> bool
Check if all linked PRs are ready to merge
Trait Implementations§
Source§impl<'de> Deserialize<'de> for StateFile
impl<'de> Deserialize<'de> for StateFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for StateFile
impl RefUnwindSafe for StateFile
impl Send for StateFile
impl Sync for StateFile
impl Unpin for StateFile
impl UnsafeUnpin for StateFile
impl UnwindSafe for StateFile
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> FromResponse for Twhere
T: DeserializeOwned,
impl<T> FromResponse for Twhere
T: DeserializeOwned,
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