.\" Man page generated from reStructuredText. . .TH "BSON_ITER_INIT_FROM_DATA_AT_OFFSET" "3" "Jun 04, 2021" "1.17.6" "libbson" .SH NAME bson_iter_init_from_data_at_offset \- bson_iter_init_from_data_at_offset() . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C bool bson_iter_init_from_data_at_offset (bson_iter_t *iter, const uint8_t *data, size_t length, uint32_t offset, uint32_t keylen); .ft P .fi .UNINDENT .UNINDENT .SH PARAMETERS .INDENT 0.0 .IP \(bu 2 \fBiter\fP: A \fBbson_iter_t\fP\&. .IP \(bu 2 \fBdata\fP: A buffer to initialize with. This is not validated. .IP \(bu 2 \fBlength\fP: The length of \fBdata\fP in bytes. This is not validated. .IP \(bu 2 \fBoffset\fP: The offset of the field to start iterating. This is not validated. This should be an offset previously obtained from \fBbson_iter_offset()\fP\&. .IP \(bu 2 \fBkeylen\fP: The string length of the key of the field to start iterating. This is not validated. This should be a length previously obtained from \fBbson_iter_key_len()\fP\&. .UNINDENT .SH DESCRIPTION .sp Creates a \fBbson_iter_t\fP and starts iteration on a field at the offset. .sp \fBbson_iter_init_from_data_at_offset\fP is useful for situations where the progress of a \fBbson_iter_t\fP must be saved and restored without relying on the \fBbson_iter_t\fP data layout. Saving the progress could be accomplished by: .INDENT 0.0 .IP \(bu 2 Saving the current field\(aqs key length with \fBbson_iter_key_len()\fP .IP \(bu 2 Saving the current offset with \fBbson_iter_offset()\fP .IP \(bu 2 Saving the data pointer of the iterated \fBbson_t\fP with \fBbson_get_data()\fP .IP \(bu 2 Saving the data length of the iterated \fBbson_t\fP with the \fBlen\fP struct field .UNINDENT .sp Then later, these saved values can be passed to \fBbson_iter_init_from_data_at_offset()\fP to reconstruct the \fBbson_iter_t\fP in constant time. .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 \fBbson_iter_key_len()\fP .IP \(bu 2 \fBbson_iter_offset()\fP .IP \(bu 2 \fBbson_get_data()\fP .UNINDENT .SH RETURNS .sp Returns true if the iter was successfully initialized. .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .