Struct glib::MarkupParseContext
source · #[repr(transparent)]pub struct MarkupParseContext { /* private fields */ }
Expand description
A parse context is used to parse a stream of bytes that you expect to contain marked-up text.
See g_markup_parse_context_new()
, GMarkupParser
, and so
on for more details.
Implementations§
source§impl MarkupParseContext
impl MarkupParseContext
sourcepub fn end_parse(&self) -> Result<(), Error>
pub fn end_parse(&self) -> Result<(), Error>
Signals to the MarkupParseContext
that all data has been
fed into the parse context with parse()
.
This function reports an error if the document isn’t complete, for example if elements are still open.
Returns
sourcepub fn position(&self) -> (i32, i32)
pub fn position(&self) -> (i32, i32)
Retrieves the current line number and the number of the character on that line. Intended for use in error messages; there are no strict semantics for what constitutes the “current” line number other than “the best number we could come up with for error messages.”
Returns
line_number
return location for a line number, or None
char_number
return location for a char-on-line number, or None
sourcepub fn parse(&self, text: &str) -> Result<(), Error>
pub fn parse(&self, text: &str) -> Result<(), Error>
Feed some data to the MarkupParseContext
.
The data need not be valid UTF-8; an error will be signaled if
it’s invalid. The data need not be an entire document; you can
feed a document into the parser incrementally, via multiple calls
to this function. Typically, as you receive data from a network
connection or file, you feed each received chunk of data into this
function, aborting the process if an error occurs. Once an error
is reported, no further data may be fed to the MarkupParseContext
;
all errors are fatal.
text
chunk of text to parse
text_len
length of text
in bytes
Returns
Trait Implementations§
source§impl Clone for MarkupParseContext
impl Clone for MarkupParseContext
source§impl Debug for MarkupParseContext
impl Debug for MarkupParseContext
source§impl From<MarkupParseContext> for Value
impl From<MarkupParseContext> for Value
source§fn from(s: MarkupParseContext) -> Self
fn from(s: MarkupParseContext) -> Self
source§impl HasParamSpec for MarkupParseContext
impl HasParamSpec for MarkupParseContext
type ParamSpec = ParamSpecBoxed
§type SetValue = MarkupParseContext
type SetValue = MarkupParseContext
type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, MarkupParseContext>
fn param_spec_builder() -> Self::BuilderFn
source§impl Hash for MarkupParseContext
impl Hash for MarkupParseContext
source§impl Ord for MarkupParseContext
impl Ord for MarkupParseContext
source§fn cmp(&self, other: &MarkupParseContext) -> Ordering
fn cmp(&self, other: &MarkupParseContext) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<MarkupParseContext> for MarkupParseContext
impl PartialEq<MarkupParseContext> for MarkupParseContext
source§fn eq(&self, other: &MarkupParseContext) -> bool
fn eq(&self, other: &MarkupParseContext) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<MarkupParseContext> for MarkupParseContext
impl PartialOrd<MarkupParseContext> for MarkupParseContext
source§fn partial_cmp(&self, other: &MarkupParseContext) -> Option<Ordering>
fn partial_cmp(&self, other: &MarkupParseContext) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for MarkupParseContext
impl StaticType for MarkupParseContext
source§fn static_type() -> Type
fn static_type() -> Type
Self
.