code: def _register_task(self, output_type, rule, union_rules):
      
      func = Function(self._to_key(rule.func))
      self._native.lib.tasks_task_begin(self._tasks, func, self._to_type(output_type), rule.cacheable)
      for selector in rule.input_selectors:
        self._native.lib.tasks_add_select(self._tasks, self._to_type(selector))
  
      def add_get_edge(product, subject):
        self._native.lib.tasks_add_get(self._tasks, self._to_type(product), self._to_type(subject))
  
      for the_get in rule.input_gets:
        union_members = union_rules.get(the_get.subject_declared_type, None)
        if union_members:
          # If the registered subject type is a union, add Get edges to all registered union members.
          for union_member in union_members:
            add_get_edge(the_get.product, union_member)
        else:
          # Otherwise, the Get subject is a "concrete" type, so add a single Get edge.
          add_get_edge(the_get.product, the_get.subject_declared_type)
  
      self._native.lib.tasks_task_end(self._tasks)
docs: Register the given TaskRule with the native scheduler.