[][src]Struct cpclib_basic::BasicProgram

pub struct BasicProgram { /* fields omitted */ }

Encode a complete basic program

Methods

impl BasicProgram[src]

pub fn new(lines: Vec<BasicLine>) -> Self[src]

Create the program from a list of lines

pub fn parse<S: AsRef<str>>(code: S) -> Result<Self, String>[src]

Create the program from a code to parse

pub fn add_line(&mut self, line: BasicLine)[src]

Add a line to the program. If a line with the same number already exists, it is replaced

pub fn get_line_mut(
    &mut self,
    idx: BasicProgramLineIdx
) -> Option<&mut BasicLine>
[src]

Returns a mutable reference on the requested line if exists

pub fn get_line(&mut self, idx: BasicProgramLineIdx) -> Option<&BasicLine>[src]

Returns a reference on the requested line if exists

pub fn is_first_line(&self, idx: BasicProgramLineIdx) -> bool[src]

Returns true if the index corresponds to the very first line. False if it does not correspond or does not exists

pub fn previous_idx(
    &self,
    idx: BasicProgramLineIdx
) -> Option<BasicProgramLineIdx>
[src]

Returns the previous index of idx if it exists

pub fn has_line(&self, idx: BasicProgramLineIdx) -> bool[src]

Check if the program contains the requested line

pub fn hide_line(&mut self, idx: BasicProgramLineIdx) -> Result<(), BasicError>[src]

https://cpcrulez.fr/applications_protect-protection_logiciel_n42_ACPC.htm

pub fn hide_lines(&mut self, lines: &[u16]) -> Result<(), BasicError>[src]

pub fn as_bytes(&self) -> Vec<u8>[src]

Generate the byte stream for the gien program

Trait Implementations

impl Clone for BasicProgram[src]

impl Debug for BasicProgram[src]

impl Display for BasicProgram[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.