Struct debian_control::control::Control
source · pub struct Control(/* private fields */);
Implementations§
source§impl Control
impl Control
sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/create-file.rs (line 4)
3 4 5 6 7 8 9 10 11 12 13 14
pub fn main() {
let mut control = Control::new();
let mut source = control.add_source("hello");
source.set_section(Some("rust"));
let mut binary = control.add_binary("hello");
binary.set_architecture(Some("amd64"));
binary.set_priority(Some(Priority::Optional));
binary.set_description(Some("Hello, world!"));
println!("{}", control);
}
pub fn as_mut_deb822(&mut self) -> &mut Deb822
pub fn as_deb822(&self) -> &Deb822
pub fn source(&self) -> Option<Source>
pub fn binaries(&self) -> impl Iterator<Item = Binary>
sourcepub fn add_source(&mut self, name: &str) -> Source
pub fn add_source(&mut self, name: &str) -> Source
Add a new source package
§Arguments
name
- The name of the source package
§Returns
The newly created source package
§Example
use debian_control::control::Control;
let mut control = Control::new();
let source = control.add_source("foo");
assert_eq!(source.name(), Some("foo".to_owned()));
Examples found in repository?
examples/create-file.rs (line 5)
3 4 5 6 7 8 9 10 11 12 13 14
pub fn main() {
let mut control = Control::new();
let mut source = control.add_source("hello");
source.set_section(Some("rust"));
let mut binary = control.add_binary("hello");
binary.set_architecture(Some("amd64"));
binary.set_priority(Some(Priority::Optional));
binary.set_description(Some("Hello, world!"));
println!("{}", control);
}
sourcepub fn add_binary(&mut self, name: &str) -> Binary
pub fn add_binary(&mut self, name: &str) -> Binary
Add new binary package
§Arguments
name
- The name of the binary package
§Returns
The newly created binary package
§Example
use debian_control::control::Control;
let mut control = Control::new();
let binary = control.add_binary("foo");
assert_eq!(binary.name(), Some("foo".to_owned()));
Examples found in repository?
examples/create-file.rs (line 8)
3 4 5 6 7 8 9 10 11 12 13 14
pub fn main() {
let mut control = Control::new();
let mut source = control.add_source("hello");
source.set_section(Some("rust"));
let mut binary = control.add_binary("hello");
binary.set_architecture(Some("amd64"));
binary.set_priority(Some(Priority::Optional));
binary.set_description(Some("Hello, world!"));
println!("{}", control);
}
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn from_file_relaxed<P: AsRef<Path>>( path: P, ) -> Result<(Self, Vec<String>), Error>
pub fn read<R: Read>(r: R) -> Result<Self, Error>
pub fn read_relaxed<R: Read>(r: R) -> Result<(Self, Vec<String>), Error>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Control
impl !RefUnwindSafe for Control
impl !Send for Control
impl !Sync for Control
impl Unpin for Control
impl !UnwindSafe for Control
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