//go:build !no_gotd_slices
// +build !no_gotd_slices

// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// BotMenuButtonClassArray is adapter for slice of BotMenuButtonClass.
type BotMenuButtonClassArray []BotMenuButtonClass

// Sort sorts slice of BotMenuButtonClass.
func ( BotMenuButtonClassArray) ( func(,  BotMenuButtonClass) bool) BotMenuButtonClassArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of BotMenuButtonClass.
func ( BotMenuButtonClassArray) ( func(,  BotMenuButtonClass) bool) BotMenuButtonClassArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of BotMenuButtonClass.
func ( BotMenuButtonClassArray) ( func( BotMenuButtonClass) bool) BotMenuButtonClassArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( BotMenuButtonClassArray) () ( BotMenuButtonClass,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( BotMenuButtonClassArray) () ( BotMenuButtonClass,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *BotMenuButtonClassArray) () ( BotMenuButtonClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  BotMenuButtonClass
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *BotMenuButtonClassArray) () ( BotMenuButtonClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// AsBotMenuButton returns copy with only BotMenuButton constructors.
func ( BotMenuButtonClassArray) () ( BotMenuButtonArray) {
	for ,  := range  {
		,  := .(*BotMenuButton)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// BotMenuButtonArray is adapter for slice of BotMenuButton.
type BotMenuButtonArray []BotMenuButton

// Sort sorts slice of BotMenuButton.
func ( BotMenuButtonArray) ( func(,  BotMenuButton) bool) BotMenuButtonArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of BotMenuButton.
func ( BotMenuButtonArray) ( func(,  BotMenuButton) bool) BotMenuButtonArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of BotMenuButton.
func ( BotMenuButtonArray) ( func( BotMenuButton) bool) BotMenuButtonArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( BotMenuButtonArray) () ( BotMenuButton,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( BotMenuButtonArray) () ( BotMenuButton,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *BotMenuButtonArray) () ( BotMenuButton,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  BotMenuButton
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *BotMenuButtonArray) () ( BotMenuButton,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}