LCOV - code coverage report
Current view: top level - engine/components - lib.go Coverage Total Hit
Test: coverage.lcov Lines: 100.0 % 4 4
Test Date: 2026-11-19 00:25:22 Functions: - 0 0

            Line data    Source code
       1              : package components
       2              : 
       3              : import (
       4              :         "fmt"
       5              : 
       6              :         "github.com/mlange-42/ark/ecs"
       7              : )
       8              : 
       9              : // ComponentInitializer はコンポーネントの初期化を行うインターフェース
      10              : type ComponentInitializer interface {
      11              :         InitializeComponents(world *ecs.World) error
      12              : }
      13              : 
      14              : // Components はジェネリクス型を使用した型安全な実装
      15              : type Components[T ComponentInitializer] struct {
      16              :         Game T
      17              : }
      18              : 
      19              : // InitComponents はジェネリクス型を使用した型安全な実装
      20              : func InitComponents[T ComponentInitializer](world *ecs.World, gameComponents T) (*Components[T], error) {
      21            1 :         if err := gameComponents.InitializeComponents(world); err != nil {
      22            1 :                 return nil, fmt.Errorf("failed to initialize components: %w", err)
      23            1 :         }
      24              : 
      25            1 :         return &Components[T]{Game: gameComponents}, nil
      26              : }
        

Generated by: LCOV version 2.0-1