Module rspamd_text

This module provides access to opaque text structures used widely to prevent copying between Lua and C for various concerns: performance, security etc…

You can convert rspamd_text into string but it will copy data.

Brief content:

Methods:

Method Description
rspamd_text:len() Returns length of a string.
rspamd_text:str() Converts text to string by copying its content.
rspamd_text:ptr() Converts text to lightuserdata.
rspamd_text:save_in_file(fname[, mode]) Saves text in file.

Methods

The module rspamd_text defines the following methods.

Method rspamd_text:len()

Returns length of a string

Parameters:

No parameters

Returns:

  • {number}: length of string in bytes

Back to module description.

Method rspamd_text:str()

Converts text to string by copying its content

Parameters:

No parameters

Returns:

  • {string}: copy of text as Lua string

Back to module description.

Method rspamd_text:ptr()

Converts text to lightuserdata

Parameters:

No parameters

Returns:

  • {lightuserdata}: pointer value of rspamd_text

Back to module description.

Method rspamd_text:save_in_file(fname[, mode])

Saves text in file

Parameters:

No parameters

Returns:

  • {boolean}: true if save has been completed

Back to module description.

Back to top.