Skip to main content

SignalsOfNavigationServer2D

Struct SignalsOfNavigationServer2D 

pub struct SignalsOfNavigationServer2D<'c, C>
where C: WithSignals,
{ /* private fields */ }
Available on crate feature experimental-godot-api only.
Expand description

A collection of signals for the NavigationServer2D class.

Implementations§

§

impl<'c, C> SignalsOfNavigationServer2D<'c, C>
where C: WithSignals,

pub fn map_changed(&mut self) -> SigMapChanged<'c, C>

Signature: (map: Rid)

pub fn navigation_debug_changed(&mut self) -> SigNavigationDebugChanged<'c, C>

Signature: ()

pub fn avoidance_debug_changed(&mut self) -> SigAvoidanceDebugChanged<'c, C>

Signature: ()

Methods from Deref<Target = <<NavigationServer2D as GodotClass>::Base as WithSignals>::SignalCollection<'c, C>>§

pub fn get_maps(&self) -> Array<Rid>

Returns all created navigation map RIDs on the NavigationServer. This returns both 2D and 3D created navigation maps as there is technically no distinction between them.

pub fn map_create(&mut self) -> Rid

Create a new map.

pub fn map_set_active(&mut self, map: Rid, active: bool)

Sets the map active.

pub fn map_is_active(&self, map: Rid) -> bool

Returns true if the map is active.

pub fn map_set_cell_size(&mut self, map: Rid, cell_size: f32)

Sets the map cell size used to rasterize the navigation mesh vertices. Must match with the cell size of the used navigation meshes.

pub fn map_get_cell_size(&self, map: Rid) -> f32

Returns the map cell size used to rasterize the navigation mesh vertices.

pub fn map_set_merge_rasterizer_cell_scale(&mut self, map: Rid, scale: f32)

Set the map’s internal merge rasterizer cell scale used to control merging sensitivity.

pub fn map_get_merge_rasterizer_cell_scale(&self, map: Rid) -> f32

Returns map’s internal merge rasterizer cell scale.

pub fn map_set_use_edge_connections(&mut self, map: Rid, enabled: bool)

Set the navigation map edge connection use. If enabled is true, the navigation map allows navigation regions to use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.

pub fn map_get_use_edge_connections(&self, map: Rid) -> bool

Returns whether the navigation map allows navigation regions to use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.

pub fn map_set_edge_connection_margin(&mut self, map: Rid, margin: f32)

Set the map edge connection margin used to weld the compatible region edges.

pub fn map_get_edge_connection_margin(&self, map: Rid) -> f32

Returns the edge connection margin of the map. The edge connection margin is a distance used to connect two regions.

Set the map’s link connection radius used to connect links to navigation polygons.

Returns the link connection radius of the map. This distance is the maximum range any link will search for navigation mesh polygons to connect to.

pub fn map_get_path( &mut self, map: Rid, origin: Vector2, destination: Vector2, optimize: bool, ) -> PackedArray<Vector2>

To set the default parameters, use map_get_path_ex and its builder methods. See the book for detailed usage instructions. Returns the navigation path to reach the destination from the origin. navigation_layers is a bitmask of all region navigation layers that are allowed to be in the path.

pub fn map_get_path_ex<'ex>( &'ex mut self, map: Rid, origin: Vector2, destination: Vector2, optimize: bool, ) -> ExMapGetPath<'ex>

Returns the navigation path to reach the destination from the origin. navigation_layers is a bitmask of all region navigation layers that are allowed to be in the path.

pub fn map_get_closest_point(&self, map: Rid, to_point: Vector2) -> Vector2

Returns the navigation mesh surface point closest to the provided to_point on the navigation map.

pub fn map_get_closest_point_owner(&self, map: Rid, to_point: Vector2) -> Rid

Returns the owner region RID for the navigation mesh surface point closest to the provided to_point on the navigation map.

Returns all navigation link RIDs that are currently assigned to the requested navigation map.

pub fn map_get_regions(&self, map: Rid) -> Array<Rid>

Returns all navigation regions RIDs that are currently assigned to the requested navigation map.

pub fn map_get_agents(&self, map: Rid) -> Array<Rid>

Returns all navigation agents RIDs that are currently assigned to the requested navigation map.

pub fn map_get_obstacles(&self, map: Rid) -> Array<Rid>

Returns all navigation obstacle RIDs that are currently assigned to the requested navigation map.

pub fn map_force_update(&mut self, map: Rid)

This function immediately forces synchronization of the specified navigation map RID. By default navigation maps are only synchronized at the end of each physics frame. This function can be used to immediately (re)calculate all the navigation meshes and region connections of the navigation map. This makes it possible to query a navigation path for a changed map immediately and in the same frame (multiple times if needed).

Due to technical restrictions the current NavigationServer command queue will be flushed. This means all already queued update commands for this physics frame will be executed, even those intended for other maps, regions and agents not part of the specified map. The expensive computation of the navigation meshes and region connections of a map will only be done for the specified map. Other maps will receive the normal synchronization at the end of the physics frame. Should the specified map receive changes after the forced update it will update again as well when the other maps receive their update.

Avoidance processing and dispatch of the safe_velocity signals is unaffected by this function and continues to happen for all maps and agents at the end of the physics frame.

Note: With great power comes great responsibility. This function should only be used by users that really know what they are doing and have a good reason for it. Forcing an immediate update of a navigation map requires locking the NavigationServer and flushing the entire NavigationServer command queue. Not only can this severely impact the performance of a game but it can also introduce bugs if used inappropriately without much foresight.

pub fn map_get_iteration_id(&self, map: Rid) -> u32

Returns the current iteration id of the navigation map. Every time the navigation map changes and synchronizes the iteration id increases. An iteration id of 0 means the navigation map has never synchronized.

Note: The iteration id will wrap back to 1 after reaching its range limit.

pub fn map_set_use_async_iterations(&mut self, map: Rid, enabled: bool)

If enabled is true the map synchronization uses an async process that runs on a background thread.

pub fn map_get_use_async_iterations(&self, map: Rid) -> bool

Returns true if the map synchronization uses an async process that runs on a background thread.

pub fn map_get_random_point( &self, map: Rid, navigation_layers: u32, uniformly: bool, ) -> Vector2

Returns a random position picked from all map region polygons with matching navigation_layers.

If uniformly is true, all map regions, polygons, and faces are weighted by their surface area (slower).

If uniformly is false, just a random region and a random polygon are picked (faster).

pub fn query_path( &mut self, parameters: impl AsArg<Option<Gd<NavigationPathQueryParameters2D>>>, result: impl AsArg<Option<Gd<NavigationPathQueryResult2D>>>, )

To set the default parameters, use query_path_ex and its builder methods. See the book for detailed usage instructions. Queries a path in a given navigation map. Start and target position and other parameters are defined through NavigationPathQueryParameters2D. Updates the provided NavigationPathQueryResult2D result object with the path among other results requested by the query. After the process is finished the optional callback will be called.

pub fn query_path_ex<'ex>( &'ex mut self, parameters: impl AsArg<Option<Gd<NavigationPathQueryParameters2D>>> + 'ex, result: impl AsArg<Option<Gd<NavigationPathQueryResult2D>>> + 'ex, ) -> ExQueryPath<'ex>

Queries a path in a given navigation map. Start and target position and other parameters are defined through NavigationPathQueryParameters2D. Updates the provided NavigationPathQueryResult2D result object with the path among other results requested by the query. After the process is finished the optional callback will be called.

pub fn region_create(&mut self) -> Rid

Creates a new region.

pub fn region_get_iteration_id(&self, region: Rid) -> u32

Returns the current iteration ID of the navigation region. Every time the navigation region changes and synchronizes, the iteration ID increases. An iteration ID of 0 means the navigation region has never synchronized.

Note: The iteration ID will wrap around to 1 after reaching its range limit.

pub fn region_set_use_async_iterations(&mut self, region: Rid, enabled: bool)

If enabled is true the region uses an async synchronization process that runs on a background thread.

pub fn region_get_use_async_iterations(&self, region: Rid) -> bool

Returns true if the region uses an async synchronization process that runs on a background thread.

pub fn region_set_enabled(&mut self, region: Rid, enabled: bool)

If enabled is true the specified region will contribute to its current navigation map.

pub fn region_get_enabled(&self, region: Rid) -> bool

Returns true if the specified region is enabled.

pub fn region_set_use_edge_connections(&mut self, region: Rid, enabled: bool)

If enabled is true, the navigation region will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.

pub fn region_get_use_edge_connections(&self, region: Rid) -> bool

Returns whether the navigation region is set to use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.

pub fn region_set_enter_cost(&mut self, region: Rid, enter_cost: f32)

Sets the enter_cost for this region.

pub fn region_get_enter_cost(&self, region: Rid) -> f32

Returns the enter cost of this region.

pub fn region_set_travel_cost(&mut self, region: Rid, travel_cost: f32)

Sets the travel_cost for this region.

pub fn region_get_travel_cost(&self, region: Rid) -> f32

Returns the travel cost of this region.

pub fn region_set_owner_id(&mut self, region: Rid, owner_id: u64)

Set the ObjectID of the object which manages this region.

pub fn region_get_owner_id(&self, region: Rid) -> u64

Returns the ObjectID of the object which manages this region.

pub fn region_owns_point(&self, region: Rid, point: Vector2) -> bool

Returns true if the provided point in world space is currently owned by the provided navigation region. Owned in this context means that one of the region’s navigation mesh polygon faces has a possible position at the closest distance to this point compared to all other navigation meshes from other navigation regions that are also registered on the navigation map of the provided region.

If multiple navigation meshes have positions at equal distance the navigation region whose polygons are processed first wins the ownership. Polygons are processed in the same order that navigation regions were registered on the NavigationServer.

Note: If navigation meshes from different navigation regions overlap (which should be avoided in general) the result might not be what is expected.

pub fn region_set_map(&mut self, region: Rid, map: Rid)

Sets the map for the region.

pub fn region_get_map(&self, region: Rid) -> Rid

Returns the navigation map RID the requested region is currently assigned to.

pub fn region_set_navigation_layers( &mut self, region: Rid, navigation_layers: u32, )

Set the region’s navigation layers. This allows selecting regions from a path request (when using map_get_path).

pub fn region_get_navigation_layers(&self, region: Rid) -> u32

Returns the region’s navigation layers.

pub fn region_set_transform(&mut self, region: Rid, transform: Transform2D)

Sets the global transformation for the region.

pub fn region_get_transform(&self, region: Rid) -> Transform2D

Returns the global transformation of this region.

pub fn region_set_navigation_polygon( &mut self, region: Rid, navigation_polygon: impl AsArg<Option<Gd<NavigationPolygon>>>, )

Sets the navigation_polygon for the region.

pub fn region_get_connections_count(&self, region: Rid) -> i32

Returns how many connections this region has with other regions in the map.

pub fn region_get_connection_pathway_start( &self, region: Rid, connection: i32, ) -> Vector2

Returns the starting point of a connection door. connection is an index between 0 and the return value of region_get_connections_count.

pub fn region_get_connection_pathway_end( &self, region: Rid, connection: i32, ) -> Vector2

Returns the ending point of a connection door. connection is an index between 0 and the return value of region_get_connections_count.

pub fn region_get_closest_point( &self, region: Rid, to_point: Vector2, ) -> Vector2

Returns the navigation mesh surface point closest to the provided to_point on the navigation region.

pub fn region_get_random_point( &self, region: Rid, navigation_layers: u32, uniformly: bool, ) -> Vector2

Returns a random position picked from all region polygons with matching navigation_layers.

If uniformly is true, all region polygons and faces are weighted by their surface area (slower).

If uniformly is false, just a random polygon and face is picked (faster).

pub fn region_get_bounds(&self, region: Rid) -> Rect2

Returns the axis-aligned rectangle for the region’s transformed navigation mesh.

Create a new link between two positions on a map.

Returns the current iteration ID of the navigation link. Every time the navigation link changes and synchronizes, the iteration ID increases. An iteration ID of 0 means the navigation link has never synchronized.

Note: The iteration ID will wrap around to 1 after reaching its range limit.

Sets the navigation map RID for the link.

Returns the navigation map RID the requested link is currently assigned to.

If enabled is true, the specified link will contribute to its current navigation map.

Returns true if the specified link is enabled.

Sets whether this link can be travelled in both directions.

Returns whether this link can be travelled in both directions.

Set the links’s navigation layers. This allows selecting links from a path request (when using map_get_path).

Returns the navigation layers for this link.

Sets the entry position for this link.

Returns the starting position of this link.

Sets the exit position for the link.

Returns the ending position of this link.

Sets the enter_cost for this link.

Returns the enter cost of this link.

Sets the travel_cost for this link.

Returns the travel cost of this link.

Set the ObjectID of the object which manages this link.

Returns the ObjectID of the object which manages this link.

pub fn agent_create(&mut self) -> Rid

Creates the agent.

pub fn agent_set_avoidance_enabled(&mut self, agent: Rid, enabled: bool)

If enabled is true, the specified agent uses avoidance.

pub fn agent_get_avoidance_enabled(&self, agent: Rid) -> bool

Return true if the specified agent uses avoidance.

pub fn agent_set_map(&mut self, agent: Rid, map: Rid)

Puts the agent in the map.

pub fn agent_get_map(&self, agent: Rid) -> Rid

Returns the navigation map RID the requested agent is currently assigned to.

pub fn agent_set_paused(&mut self, agent: Rid, paused: bool)

If paused is true the specified agent will not be processed. For example, it will not calculate avoidance velocities or receive avoidance callbacks.

pub fn agent_get_paused(&self, agent: Rid) -> bool

Returns true if the specified agent is paused.

pub fn agent_set_neighbor_distance(&mut self, agent: Rid, distance: f32)

Sets the maximum distance to other agents this agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe.

pub fn agent_get_neighbor_distance(&self, agent: Rid) -> f32

Returns the maximum distance to other agents the specified agent takes into account in the navigation.

pub fn agent_set_max_neighbors(&mut self, agent: Rid, count: i32)

Sets the maximum number of other agents the agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe.

pub fn agent_get_max_neighbors(&self, agent: Rid) -> i32

Returns the maximum number of other agents the specified agent takes into account in the navigation.

pub fn agent_set_time_horizon_agents(&mut self, agent: Rid, time_horizon: f32)

The minimal amount of time for which the agent’s velocities that are computed by the simulation are safe with respect to other agents. The larger this number, the sooner this agent will respond to the presence of other agents, but the less freedom this agent has in choosing its velocities. A too high value will slow down agents movement considerably. Must be positive.

pub fn agent_get_time_horizon_agents(&self, agent: Rid) -> f32

Returns the minimal amount of time for which the specified agent’s velocities that are computed by the simulation are safe with respect to other agents.

pub fn agent_set_time_horizon_obstacles( &mut self, agent: Rid, time_horizon: f32, )

The minimal amount of time for which the agent’s velocities that are computed by the simulation are safe with respect to static avoidance obstacles. The larger this number, the sooner this agent will respond to the presence of static avoidance obstacles, but the less freedom this agent has in choosing its velocities. A too high value will slow down agents movement considerably. Must be positive.

pub fn agent_get_time_horizon_obstacles(&self, agent: Rid) -> f32

Returns the minimal amount of time for which the specified agent’s velocities that are computed by the simulation are safe with respect to static avoidance obstacles.

pub fn agent_set_radius(&mut self, agent: Rid, radius: f32)

Sets the radius of the agent.

pub fn agent_get_radius(&self, agent: Rid) -> f32

Returns the radius of the specified agent.

pub fn agent_set_max_speed(&mut self, agent: Rid, max_speed: f32)

Sets the maximum speed of the agent. Must be positive.

pub fn agent_get_max_speed(&self, agent: Rid) -> f32

Returns the maximum speed of the specified agent.

pub fn agent_set_velocity_forced(&mut self, agent: Rid, velocity: Vector2)

Replaces the internal velocity in the collision avoidance simulation with velocity for the specified agent. When an agent is teleported to a new position far away this function should be used in the same frame. If called frequently this function can get agents stuck.

pub fn agent_set_velocity(&mut self, agent: Rid, velocity: Vector2)

Sets velocity as the new wanted velocity for the specified agent. The avoidance simulation will try to fulfill this velocity if possible but will modify it to avoid collision with other agent’s and obstacles. When an agent is teleported to a new position far away use agent_set_velocity_forced instead to reset the internal velocity state.

pub fn agent_get_velocity(&self, agent: Rid) -> Vector2

Returns the velocity of the specified agent.

pub fn agent_set_position(&mut self, agent: Rid, position: Vector2)

Sets the position of the agent in world space.

pub fn agent_get_position(&self, agent: Rid) -> Vector2

Returns the position of the specified agent in world space.

pub fn agent_is_map_changed(&self, agent: Rid) -> bool

Returns true if the map got changed the previous frame.

pub fn agent_set_avoidance_callback(&mut self, agent: Rid, callback: &Callable)

Sets the callback Callable that gets called after each avoidance processing step for the agent. The calculated safe_velocity will be dispatched with a signal to the object just before the physics calculations.

Note: Created callbacks are always processed independently of the SceneTree state as long as the agent is on a navigation map and not freed. To disable the dispatch of a callback from an agent use agent_set_avoidance_callback again with an empty Callable.

pub fn agent_has_avoidance_callback(&self, agent: Rid) -> bool

Return true if the specified agent has an avoidance callback.

pub fn agent_set_avoidance_layers(&mut self, agent: Rid, layers: u32)

Set the agent’s avoidance_layers bitmask.

pub fn agent_get_avoidance_layers(&self, agent: Rid) -> u32

Returns the avoidance_layers bitmask of the specified agent.

pub fn agent_set_avoidance_mask(&mut self, agent: Rid, mask: u32)

Set the agent’s avoidance_mask bitmask.

pub fn agent_get_avoidance_mask(&self, agent: Rid) -> u32

Returns the avoidance_mask bitmask of the specified agent.

pub fn agent_set_avoidance_priority(&mut self, agent: Rid, priority: f32)

Set the agent’s avoidance_priority with a priority between 0.0 (lowest priority) to 1.0 (highest priority).

The specified agent does not adjust the velocity for other agents that would match the avoidance_mask but have a lower avoidance_priority. This in turn makes the other agents with lower priority adjust their velocities even more to avoid collision with this agent.

pub fn agent_get_avoidance_priority(&self, agent: Rid) -> f32

Returns the avoidance_priority of the specified agent.

pub fn obstacle_create(&mut self) -> Rid

Creates a new navigation obstacle.

pub fn obstacle_set_avoidance_enabled(&mut self, obstacle: Rid, enabled: bool)

If enabled is true, the provided obstacle affects avoidance using agents.

pub fn obstacle_get_avoidance_enabled(&self, obstacle: Rid) -> bool

Returns true if the provided obstacle has avoidance enabled.

pub fn obstacle_set_map(&mut self, obstacle: Rid, map: Rid)

Sets the navigation map RID for the obstacle.

pub fn obstacle_get_map(&self, obstacle: Rid) -> Rid

Returns the navigation map RID the requested obstacle is currently assigned to.

pub fn obstacle_set_paused(&mut self, obstacle: Rid, paused: bool)

If paused is true the specified obstacle will not be processed. For example, it will no longer affect avoidance velocities.

pub fn obstacle_get_paused(&self, obstacle: Rid) -> bool

Returns true if the specified obstacle is paused.

pub fn obstacle_set_radius(&mut self, obstacle: Rid, radius: f32)

Sets the radius of the dynamic obstacle.

pub fn obstacle_get_radius(&self, obstacle: Rid) -> f32

Returns the radius of the specified dynamic obstacle.

pub fn obstacle_set_velocity(&mut self, obstacle: Rid, velocity: Vector2)

Sets velocity of the dynamic obstacle. Allows other agents to better predict the movement of the dynamic obstacle. Only works in combination with the radius of the obstacle.

pub fn obstacle_get_velocity(&self, obstacle: Rid) -> Vector2

Returns the velocity of the specified dynamic obstacle.

pub fn obstacle_set_position(&mut self, obstacle: Rid, position: Vector2)

Sets the position of the obstacle in world space.

pub fn obstacle_get_position(&self, obstacle: Rid) -> Vector2

Returns the position of the specified obstacle in world space.

pub fn obstacle_set_vertices( &mut self, obstacle: Rid, vertices: &PackedArray<Vector2>, )

Sets the outline vertices for the obstacle. If the vertices are winded in clockwise order agents will be pushed in by the obstacle, else they will be pushed out.

pub fn obstacle_get_vertices(&self, obstacle: Rid) -> PackedArray<Vector2>

Returns the outline vertices for the specified obstacle.

pub fn obstacle_set_avoidance_layers(&mut self, obstacle: Rid, layers: u32)

Set the obstacles’s avoidance_layers bitmask.

pub fn obstacle_get_avoidance_layers(&self, obstacle: Rid) -> u32

Returns the avoidance_layers bitmask of the specified obstacle.

pub fn parse_source_geometry_data( &mut self, navigation_polygon: impl AsArg<Option<Gd<NavigationPolygon>>>, source_geometry_data: impl AsArg<Option<Gd<NavigationMeshSourceGeometryData2D>>>, root_node: impl AsArg<Option<Gd<Node>>>, )

To set the default parameters, use parse_source_geometry_data_ex and its builder methods. See the book for detailed usage instructions. Parses the SceneTree for source geometry according to the properties of navigation_polygon. Updates the provided source_geometry_data resource with the resulting data. The resource can then be used to bake a navigation mesh with bake_from_source_geometry_data. After the process is finished the optional callback will be called.

Note: This function needs to run on the main thread or with a deferred call as the SceneTree is not thread-safe.

Performance: While convenient, reading data arrays from Mesh resources can affect the frame rate negatively. The data needs to be received from the GPU, stalling the RenderingServer in the process. For performance prefer the use of e.g. collision shapes or creating the data arrays entirely in code.

pub fn parse_source_geometry_data_ex<'ex>( &'ex mut self, navigation_polygon: impl AsArg<Option<Gd<NavigationPolygon>>> + 'ex, source_geometry_data: impl AsArg<Option<Gd<NavigationMeshSourceGeometryData2D>>> + 'ex, root_node: impl AsArg<Option<Gd<Node>>> + 'ex, ) -> ExParseSourceGeometryData<'ex>

Parses the SceneTree for source geometry according to the properties of navigation_polygon. Updates the provided source_geometry_data resource with the resulting data. The resource can then be used to bake a navigation mesh with bake_from_source_geometry_data. After the process is finished the optional callback will be called.

Note: This function needs to run on the main thread or with a deferred call as the SceneTree is not thread-safe.

Performance: While convenient, reading data arrays from Mesh resources can affect the frame rate negatively. The data needs to be received from the GPU, stalling the RenderingServer in the process. For performance prefer the use of e.g. collision shapes or creating the data arrays entirely in code.

pub fn bake_from_source_geometry_data( &mut self, navigation_polygon: impl AsArg<Option<Gd<NavigationPolygon>>>, source_geometry_data: impl AsArg<Option<Gd<NavigationMeshSourceGeometryData2D>>>, )

To set the default parameters, use bake_from_source_geometry_data_ex and its builder methods. See the book for detailed usage instructions. Bakes the provided navigation_polygon with the data from the provided source_geometry_data. After the process is finished the optional callback will be called.

pub fn bake_from_source_geometry_data_ex<'ex>( &'ex mut self, navigation_polygon: impl AsArg<Option<Gd<NavigationPolygon>>> + 'ex, source_geometry_data: impl AsArg<Option<Gd<NavigationMeshSourceGeometryData2D>>> + 'ex, ) -> ExBakeFromSourceGeometryData<'ex>

Bakes the provided navigation_polygon with the data from the provided source_geometry_data. After the process is finished the optional callback will be called.

pub fn bake_from_source_geometry_data_async( &mut self, navigation_polygon: impl AsArg<Option<Gd<NavigationPolygon>>>, source_geometry_data: impl AsArg<Option<Gd<NavigationMeshSourceGeometryData2D>>>, )

To set the default parameters, use bake_from_source_geometry_data_async_ex and its builder methods. See the book for detailed usage instructions. Bakes the provided navigation_polygon with the data from the provided source_geometry_data as an async task running on a background thread. After the process is finished the optional callback will be called.

pub fn bake_from_source_geometry_data_async_ex<'ex>( &'ex mut self, navigation_polygon: impl AsArg<Option<Gd<NavigationPolygon>>> + 'ex, source_geometry_data: impl AsArg<Option<Gd<NavigationMeshSourceGeometryData2D>>> + 'ex, ) -> ExBakeFromSourceGeometryDataAsync<'ex>

Bakes the provided navigation_polygon with the data from the provided source_geometry_data as an async task running on a background thread. After the process is finished the optional callback will be called.

pub fn is_baking_navigation_polygon( &self, navigation_polygon: impl AsArg<Option<Gd<NavigationPolygon>>>, ) -> bool

Returns true when the provided navigation polygon is being baked on a background thread.

pub fn source_geometry_parser_create(&mut self) -> Rid

Creates a new source geometry parser. If a Callable is set for the parser with source_geometry_parser_set_callback the callback will be called for every single node that gets parsed whenever parse_source_geometry_data is used.

pub fn source_geometry_parser_set_callback( &mut self, parser: Rid, callback: &Callable, )

Sets the callback Callable for the specific source geometry parser. The Callable will receive a call with the following parameters:

  • navigation_mesh - The NavigationPolygon reference used to define the parse settings. Do NOT edit or add directly to the navigation mesh.

  • source_geometry_data - The NavigationMeshSourceGeometryData2D reference. Add custom source geometry for navigation mesh baking to this object.

  • node - The Node that is parsed.

pub fn simplify_path( &mut self, path: &PackedArray<Vector2>, epsilon: f32, ) -> PackedArray<Vector2>

Returns a simplified version of path with less critical path points removed. The simplification amount is in worlds units and controlled by epsilon. The simplification uses a variant of Ramer-Douglas-Peucker algorithm for curve point decimation.

Path simplification can be helpful to mitigate various path following issues that can arise with certain agent types and script behaviors. E.g. “steering” agents or avoidance in “open fields”.

pub fn free_rid(&mut self, rid: Rid)

Destroys the given RID.

pub fn set_active(&mut self, active: bool)

Control activation of this server.

pub fn set_debug_enabled(&mut self, enabled: bool)

If true enables debug mode on the NavigationServer.

pub fn get_debug_enabled(&self) -> bool

Returns true when the NavigationServer has debug enabled.

pub fn get_process_info(&self, process_info: ProcessInfo) -> i32

Returns information about the current state of the NavigationServer.

Methods from Deref<Target = Object>§

pub fn get_script(&self) -> Option<Gd<Script>>

pub fn set_script(&mut self, script: impl AsArg<Option<Gd<Script>>>)

pub fn connect( &mut self, signal: impl AsArg<StringName>, callable: &Callable, ) -> Error

pub fn connect_flags( &mut self, signal: impl AsArg<StringName>, callable: &Callable, flags: ConnectFlags, ) -> Error

pub fn get_class(&self) -> GString

Returns the object’s built-in class name, as a String. See also is_class.

Note: This method ignores class_name declarations. If this object’s script has defined a class_name, the base, built-in class name is returned instead.

pub fn is_class(&self, class: impl AsArg<GString>) -> bool

Returns true if the object inherits from the given class. See also get_class.

var sprite2d = Sprite2D.new()
sprite2d.is_class("Sprite2D") # Returns true
sprite2d.is_class("Node")     # Returns true
sprite2d.is_class("Node3D")   # Returns false

Note: This method ignores class_name declarations in the object’s script.

pub fn set(&mut self, property: impl AsArg<StringName>, value: &Variant)

Assigns value to the given property. If the property does not exist or the given value’s type doesn’t match, nothing happens.

var node = Node2D.new()
node.set("global_scale", Vector2(8, 2.5))
print(node.global_scale) # Prints (8.0, 2.5)

Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn get(&self, property: impl AsArg<StringName>) -> Variant

Returns the Variant value of the given property. If the property does not exist, this method returns null.

var node = Node2D.new()
node.rotation = 1.5
var a = node.get("rotation") # a is 1.5

Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn set_indexed( &mut self, property_path: impl AsArg<NodePath>, value: &Variant, )

Assigns a new value to the property identified by the property_path. The path should be a NodePath relative to this object, and can use the colon character (:) to access nested properties.

var node = Node2D.new()
node.set_indexed("position", Vector2(42, 0))
node.set_indexed("position:y", -10)
print(node.position) # Prints (42.0, -10.0)

Note: In C#, property_path must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn get_indexed(&self, property_path: impl AsArg<NodePath>) -> Variant

Gets the object’s property indexed by the given property_path. The path should be a NodePath relative to the current object and can use the colon character (:) to access nested properties.

Examples: "position:x" or "material:next_pass:blend_mode".

var node = Node2D.new()
node.position = Vector2(5, -10)
var a = node.get_indexed("position")   # a is Vector2(5, -10)
var b = node.get_indexed("position:y") # b is -10

Note: In C#, property_path must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

Note: This method does not support actual paths to nodes in the SceneTree, only sub-property paths. In the context of nodes, use get_node_and_resource instead.

pub fn get_property_list(&self) -> Array<Dictionary<Variant, Variant>>

Returns the object’s property list as an Array of dictionaries. Each Dictionary contains the following entries:

  • name is the property’s name, as a String;

  • class_name is an empty StringName, unless the property is VariantType::OBJECT and it inherits from a class;

  • type is the property’s type, as an int (see [enum Variant.Type]);

  • hint is how the property is meant to be edited (see [enum PropertyHint]);

  • hint_string depends on the hint (see [enum PropertyHint]);

  • usage is a combination of [enum PropertyUsageFlags].

Note: In GDScript, all class members are treated as properties. In C# and GDExtension, it may be necessary to explicitly mark class members as Godot properties using decorators or attributes.

pub fn get_method_list(&self) -> Array<Dictionary<Variant, Variant>>

Returns this object’s methods and their signatures as an Array of dictionaries. Each Dictionary contains the following entries:

  • name is the name of the method, as a String;

  • args is an Array of dictionaries representing the arguments;

  • default_args is the default arguments as an Array of variants;

  • flags is a combination of [enum MethodFlags];

  • id is the method’s internal identifier int;

  • return is the returned value, as a Dictionary;

Note: The dictionaries of args and return are formatted identically to the results of get_property_list, although not all entries are used.

pub fn property_can_revert(&self, property: impl AsArg<StringName>) -> bool

Returns true if the given property has a custom default value. Use property_get_revert to get the property’s default value.

Note: This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_can_revert] to customize the default value. If [method _property_can_revert] is not implemented, this method returns false.

pub fn property_get_revert(&self, property: impl AsArg<StringName>) -> Variant

Returns the custom default value of the given property. Use property_can_revert to check if the property has a custom default value.

Note: This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_get_revert] to customize the default value. If [method _property_get_revert] is not implemented, this method returns null.

pub fn set_meta(&mut self, name: impl AsArg<StringName>, value: &Variant)

Adds or changes the entry name inside the object’s metadata. The metadata value can be any Variant, although some types cannot be serialized correctly.

If value is null, the entry is removed. This is the equivalent of using remove_meta. See also has_meta and get_meta.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn remove_meta(&mut self, name: impl AsArg<StringName>)

Removes the given entry name from the object’s metadata. See also has_meta, get_meta and set_meta.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn get_meta(&self, name: impl AsArg<StringName>) -> Variant

To set the default parameters, use get_meta_ex and its builder methods. See the book for detailed usage instructions. Returns the object’s metadata value for the given entry name. If the entry does not exist, returns default. If default is null, an error is also generated.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn get_meta_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExGetMeta<'ex>

Returns the object’s metadata value for the given entry name. If the entry does not exist, returns default. If default is null, an error is also generated.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn has_meta(&self, name: impl AsArg<StringName>) -> bool

Returns true if a metadata entry is found with the given name. See also get_meta, set_meta and remove_meta.

Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.

Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.

pub fn get_meta_list(&self) -> Array<StringName>

Returns the object’s metadata entry names as an Array of StringNames.

pub fn add_user_signal(&mut self, signal: impl AsArg<GString>)

To set the default parameters, use add_user_signal_ex and its builder methods. See the book for detailed usage instructions. Adds a user-defined signal named signal. Optional arguments for the signal can be added as an Array of dictionaries, each defining a name String and a type int (see [enum Variant.Type]). See also has_user_signal and remove_user_signal.

add_user_signal("hurt", [
	{ "name": "damage", "type": TYPE_INT },
	{ "name": "source", "type": TYPE_OBJECT }
])

pub fn add_user_signal_ex<'ex>( &'ex mut self, signal: impl AsArg<GString> + 'ex, ) -> ExAddUserSignal<'ex>

Adds a user-defined signal named signal. Optional arguments for the signal can be added as an Array of dictionaries, each defining a name String and a type int (see [enum Variant.Type]). See also has_user_signal and remove_user_signal.

add_user_signal("hurt", [
	{ "name": "damage", "type": TYPE_INT },
	{ "name": "source", "type": TYPE_OBJECT }
])

pub fn has_user_signal(&self, signal: impl AsArg<StringName>) -> bool

Returns true if the given user-defined signal name exists. Only signals added with add_user_signal are included. See also remove_user_signal.

pub fn remove_user_signal(&mut self, signal: impl AsArg<StringName>)

Removes the given user signal signal from the object. See also add_user_signal and has_user_signal.

pub fn emit_signal( &mut self, signal: impl AsArg<StringName>, varargs: &[Variant], ) -> Error

Emits the given signal by name. The signal must exist, so it should be a built-in signal of this class or one of its inherited classes, or a user-defined signal (see add_user_signal). This method supports a variable number of arguments, so parameters can be passed as a comma separated list.

Returns Error::ERR_UNAVAILABLE if signal does not exist or the parameters are invalid.

emit_signal("hit", "sword", 100)
emit_signal("game_over")

Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_emit_signal( &mut self, signal: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Error, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn call( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant

Calls the method on the object and returns the result. This method supports a variable number of arguments, so parameters can be passed as a comma separated list.

var node = Node3D.new()
node.call("rotate", Vector3(1.0, 0.0, 0.0), 1.571)

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_call( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn call_deferred( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant

Calls the method on the object during idle time. Always returns null, not the method’s result.

Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they’ll still be run in the current idle time cycle. This means you should not call a method deferred from itself (or from a method called by it), as this causes infinite recursion the same way as if you had called the method directly.

This method supports a variable number of arguments, so parameters can be passed as a comma separated list.

var node = Node3D.new()
node.call_deferred("rotate", Vector3(1.0, 0.0, 0.0), 1.571)

For methods that are deferred from the same thread, the order of execution at idle time is identical to the order in which call_deferred was called.

See also call_deferred.

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

Note: If you’re looking to delay the function call by a frame, refer to the SceneTree.process_frame and SceneTree.physics_frame signals.

var node = Node3D.new()
# Make a Callable and bind the arguments to the node's rotate() call.
var callable = node.rotate.bind(Vector3(1.0, 0.0, 0.0), 1.571)
# Connect the callable to the process_frame signal, so it gets called in the next process frame.
# CONNECT_ONE_SHOT makes sure it only gets called once instead of every frame.
get_tree().process_frame.connect(callable, CONNECT_ONE_SHOT)
§Panics

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will panic in such a case.

pub fn try_call_deferred( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>

§Return type

This is a varcall method, meaning parameters and return values are passed as Variant. It can detect call failures and will return Err in such a case.

pub fn set_deferred( &mut self, property: impl AsArg<StringName>, value: &Variant, )

Assigns value to the given property, at the end of the current frame. This is equivalent to calling set through call_deferred.

var node = Node2D.new()
add_child(node)

node.rotation = 1.5
node.set_deferred("rotation", 3.0)
print(node.rotation) # Prints 1.5

await get_tree().process_frame
print(node.rotation) # Prints 3.0

Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.

pub fn callv( &mut self, method: impl AsArg<StringName>, arg_array: &AnyArray, ) -> Variant

Calls the method on the object and returns the result. Unlike call, this method expects all parameters to be contained inside arg_array.

var node = Node3D.new()
node.callv("rotate", [Vector3(1.0, 0.0, 0.0), 1.571])

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

pub fn has_method(&self, method: impl AsArg<StringName>) -> bool

Returns true if the given method name exists in the object.

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

pub fn get_method_argument_count(&self, method: impl AsArg<StringName>) -> i32

Returns the number of arguments of the given method by name.

Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.

pub fn has_signal(&self, signal: impl AsArg<StringName>) -> bool

Returns true if the given signal name exists in the object.

Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

pub fn get_signal_list(&self) -> Array<Dictionary<Variant, Variant>>

Returns the list of existing signals as an Array of dictionaries.

Note: Due to the implementation, each Dictionary is formatted very similarly to the returned values of get_method_list.

pub fn get_signal_connection_list( &self, signal: impl AsArg<StringName>, ) -> Array<Dictionary<Variant, Variant>>

Returns an Array of connections for the given signal name. Each connection is represented as a Dictionary that contains three entries:

  • signal is a reference to the Signal;

  • callable is a reference to the connected Callable;

  • flags is a combination of [enum ConnectFlags].

pub fn get_incoming_connections(&self) -> Array<Dictionary<Variant, Variant>>

Returns an Array of signal connections received by this object. Each connection is represented as a Dictionary that contains three entries:

  • signal is a reference to the Signal;

  • callable is a reference to the Callable;

  • flags is a combination of [enum ConnectFlags].

pub fn disconnect( &mut self, signal: impl AsArg<StringName>, callable: &Callable, )

Disconnects a signal by name from a given callable. If the connection does not exist, generates an error. Use is_connected to make sure that the connection exists.

pub fn is_connected( &self, signal: impl AsArg<StringName>, callable: &Callable, ) -> bool

Returns true if a connection exists between the given signal name and callable.

Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

pub fn has_connections(&self, signal: impl AsArg<StringName>) -> bool

Returns true if any connection exists on the given signal name.

Note: In C#, signal must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.

pub fn set_block_signals(&mut self, enable: bool)

If set to true, the object becomes unable to emit signals. As such, emit_signal and signal connections will not work, until it is set to false.

pub fn is_blocking_signals(&self) -> bool

Returns true if the object is blocking its signals from being emitted. See set_block_signals.

pub fn notify_property_list_changed(&mut self)

Emits the property_list_changed signal. This is mainly used to refresh the editor, so that the Inspector and editor plugins are properly updated.

pub fn set_message_translation(&mut self, enable: bool)

If set to true, allows the object to translate messages with tr and tr_n. Enabled by default. See also can_translate_messages.

pub fn can_translate_messages(&self) -> bool

Returns true if the object is allowed to translate messages with tr and tr_n. See also set_message_translation.

pub fn tr(&self, message: impl AsArg<StringName>) -> GString

To set the default parameters, use tr_ex and its builder methods. See the book for detailed usage instructions. Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.

If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.

For detailed examples, see Internationalizing games.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate.

pub fn tr_ex<'ex>(&'ex self, message: impl AsArg<StringName> + 'ex) -> ExTr<'ex>

Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.

If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.

For detailed examples, see Internationalizing games.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate.

pub fn tr_n( &self, message: impl AsArg<StringName>, plural_message: impl AsArg<StringName>, n: i32, ) -> GString

To set the default parameters, use tr_n_ex and its builder methods. See the book for detailed usage instructions. Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.

If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.

The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.

For detailed examples, see Localization using gettext.

Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with tr.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate_plural.

pub fn tr_n_ex<'ex>( &'ex self, message: impl AsArg<StringName> + 'ex, plural_message: impl AsArg<StringName> + 'ex, n: i32, ) -> ExTrN<'ex>

Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.

If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.

The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.

For detailed examples, see Localization using gettext.

Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with tr.

Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate_plural.

pub fn get_translation_domain(&self) -> StringName

Returns the name of the translation domain used by tr and tr_n. See also TranslationServer.

pub fn set_translation_domain(&mut self, domain: impl AsArg<StringName>)

Sets the name of the translation domain used by tr and tr_n. See also TranslationServer.

pub fn is_queued_for_deletion(&self) -> bool

Returns true if the queue_free method was called for the object.

pub fn cancel_free(&mut self)

If this method is called during ObjectNotification::PREDELETE, this object will reject being freed and will remain allocated. This is mostly an internal function used for error handling to avoid the user from freeing objects when they are not intended to.

pub fn notify(&mut self, what: ObjectNotification)

⚠️ Sends a Godot notification to all classes inherited by the object.

Triggers calls to on_notification(), and depending on the notification, also to Godot’s lifecycle callbacks such as ready().

Starts from the highest ancestor (the Object class) and goes down the hierarchy. See also Godot docs for Object::notification().

§Panics

If you call this method on a user-defined object while holding a GdRef or GdMut guard on the instance, you will encounter a panic. The reason is that the receiving virtual method on_notification() acquires a GdMut lock dynamically, which must be exclusive.

pub fn notify_reversed(&mut self, what: ObjectNotification)

⚠️ Like Self::notify(), but starts at the most-derived class and goes up the hierarchy.

See docs of that method, including the panics.

Trait Implementations§

§

impl<'c, C> Deref for SignalsOfNavigationServer2D<'c, C>
where C: WithSignals,

§

type Target = <<NavigationServer2D as GodotClass>::Base as WithSignals>::SignalCollection<'c, C>

The resulting type after dereferencing.
§

fn deref(&self) -> &<SignalsOfNavigationServer2D<'c, C> as Deref>::Target

Dereferences the value.
§

impl<'c, C> DerefMut for SignalsOfNavigationServer2D<'c, C>
where C: WithSignals,

§

fn deref_mut( &mut self, ) -> &mut <SignalsOfNavigationServer2D<'c, C> as Deref>::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'c, C> Freeze for SignalsOfNavigationServer2D<'c, C>
where <C as WithSignals>::__SignalObj<'c>: Freeze,

§

impl<'c, C> RefUnwindSafe for SignalsOfNavigationServer2D<'c, C>

§

impl<'c, C> Send for SignalsOfNavigationServer2D<'c, C>
where <C as WithSignals>::__SignalObj<'c>: Send,

§

impl<'c, C> Sync for SignalsOfNavigationServer2D<'c, C>
where <C as WithSignals>::__SignalObj<'c>: Sync,

§

impl<'c, C> Unpin for SignalsOfNavigationServer2D<'c, C>
where <C as WithSignals>::__SignalObj<'c>: Unpin,

§

impl<'c, C> UnsafeUnpin for SignalsOfNavigationServer2D<'c, C>
where <C as WithSignals>::__SignalObj<'c>: UnsafeUnpin,

§

impl<'c, C> UnwindSafe for SignalsOfNavigationServer2D<'c, C>
where <C as WithSignals>::__SignalObj<'c>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.