Function const_string

Source
pub fn const_string(string: &str, dont_null_terminate: bool) -> ValueRef
Expand description

Create a ConstantDataSequential with string content in the global context.

This is the same as const_string_in_context except it operates on the global context.

§Details

Creates a constant string value in the global LLVM context.

This function wraps the LLVMConstString function from the LLVM core library. It generates a constant string value within the global LLVM context using the provided string slice (string). The function also allows you to specify whether the string should be null-terminated. This function is similar to const_string_in_context, but it operates on the global context instead of a specified context.

§Parameters

  • string: A string slice that represents the content of the constant string. This string will be used to generate the LLVM constant.
  • dont_null_terminate: A boolean value indicating whether the string should not be null-terminated. If true, the string will not be null-terminated; if false, a null terminator will be added.

§Returns

Returns an instance of ValueRef, which encapsulates the constant string value created in the global context.