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.
GLib type: Shared boxed type with reference counted clone semantics.
Implementations§
Source§impl MarkupParseContext
impl MarkupParseContext
Sourcepub fn as_ptr(&self) -> *mut GMarkupParseContext
pub fn as_ptr(&self) -> *mut GMarkupParseContext
Return the inner pointer to the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow(ptr: &*mut GMarkupParseContext) -> &Self
pub unsafe fn from_glib_ptr_borrow(ptr: &*mut GMarkupParseContext) -> &Self
Borrows the underlying C value.
Source§impl MarkupParseContext
impl MarkupParseContext
Sourcepub fn element_stack(&self) -> Vec<GString>
pub fn element_stack(&self) -> Vec<GString>
Retrieves the element stack from the internal state of the parser.
The returned #GSList is a list of strings where the first item is the currently open tag (as would be returned by g_markup_parse_context_get_element()) and the next item is its immediate parent.
This function is intended to be used in the start_element and end_element handlers where g_markup_parse_context_get_element() would merely return the name of the element that is being processed.
§Returns
the element stack, which must not be modified
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 #GMarkupParseContext.
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 #GMarkupParseContext; 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
Source§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 for MarkupParseContext
impl PartialEq for MarkupParseContext
Source§impl PartialOrd for MarkupParseContext
impl PartialOrd for MarkupParseContext
Source§impl StaticType for MarkupParseContext
impl StaticType for MarkupParseContext
Source§fn static_type() -> Type
fn static_type() -> Type
Self
.